<?php

namespace App\Domains\Catalog\Resources\AdminApp;

use App\Domains\Catalog\Enums\ProductLayout;
use App\Domains\Catalog\Models\FeaturedGroup;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/** @mixin FeaturedGroup */
class OnTicketFeaturedGroupResource extends JsonResource
{
    /** @return array<string, mixed> */
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'code' => $this->code,
            'category_id' => $this->category_id,
            'category_name' => $this->category->nombre,
            'group_name' => $this->group_name,
            'is_featured' => $this->product_layout === ProductLayout::Row,
            'type' => $this->source_type->value,
            'product_layout' => $this->product_layout->value,
            'group_layout' => $this->group_layout->value,
            'order' => $this->group_order,
        ];
    }
}
