<?php

namespace App\Models;

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

class SignatureItem extends Model
{
    /** @use HasFactory<SignatureItemFactory> */
    use HasFactory;

    protected $fillable = [
        'name',
        'price',
        'price_unit',
        'description',
        'image',
        'sort_order',
        'is_active',
    ];

    protected function casts(): array
    {
        return [
            'price' => 'decimal:2',
            'is_active' => 'boolean',
            'sort_order' => 'integer',
        ];
    }

    public function scopeActive($query): void
    {
        $query->where('is_active', true);
    }
}
