<?php

namespace App\Domains\Catalog\Models;

use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

#[Fillable([
    'featured_group_id',
    'catalog_item_id',
    'order',
])]
class FeaturedItem extends Model
{
    use HasFactory;

    public $timestamps = false;

    protected $table = 'featured_items';

    protected function casts(): array
    {
        return [
            'featured_group_id' => 'integer',
            'catalog_item_id' => 'integer',
            'order' => 'integer',
        ];
    }

    /** @return BelongsTo<FeaturedGroup, $this> */
    public function featuredGroup(): BelongsTo
    {
        return $this->belongsTo(FeaturedGroup::class);
    }

    /** @return BelongsTo<CatalogItem, $this> */
    public function catalogItem(): BelongsTo
    {
        return $this->belongsTo(CatalogItem::class);
    }
}
