<?php

declare(strict_types=1);

namespace App\Models;

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

/**
 * 后台用户侧栏「常用功能」固定项（仅存 key 与顺序，文案与 URL 由 {@see \App\Filament\Support\DberpShortcutRegistry} 解析）。
 */
class DberpAdminMenuShortcut extends Model
{
    protected $table = 'dberp_admin_menu_shortcuts';

    /**
     * @var list<string>
     */
    protected $fillable = [
        'admin_id',
        'shortcut_key',
        'sort',
    ];

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

    /**
     * @return BelongsTo<User, $this>
     */
    public function admin(): BelongsTo
    {
        return $this->belongsTo(User::class, 'admin_id');
    }
}
