<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * @mixin IdeHelperCategoryFeature
 */
class CategoryFeature extends Model
{
    use HasFactory;

    protected $fillable = [
        'category_id',
        'feature_id',
        'is_required',
        'sort_order',
    ];

    protected $casts = [
        'is_required' => 'boolean',
        'sort_order' => 'integer',
    ];

    public function category()
    {
        return $this->belongsTo(ListingCategory::class, 'category_id');
    }

    public function feature()
    {
        return $this->belongsTo(ListingFeature::class, 'feature_id');
    }
}