<?php

declare(strict_types=1);

namespace Maestro\Core\Modules\HourRegistration\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class HourInternalCategory extends Model
{
    protected $table = 'hour_internal_categories';

    /**
     * @var list<string>
     */
    protected $fillable = [
        'name',
        'slug',
        'sort_order',
        'is_active',
    ];

    /**
     * @return array<string, string>
     */
    protected function casts(): array
    {
        return [
            'is_active' => 'boolean',
        ];
    }

    /**
     * @return HasMany<HourTimesheetLine, HourInternalCategory>
     */
    public function timesheetLines(): HasMany
    {
        return $this->hasMany(HourTimesheetLine::class, 'internal_category_id');
    }
}
