<?php

declare(strict_types=1);

namespace Maestro\Core\Models;

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

class MaestroModule extends Model
{
    protected $table = 'maestro_modules';

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

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

    /**
     * @return HasMany<NavigationNode, $this>
     */
    public function navigationNodes(): HasMany
    {
        return $this->hasMany(NavigationNode::class, 'module_id');
    }
}
