<?php

namespace App\Models;

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

class Dictionary extends Model
{
    protected $fillable = ['name', 'code', 'description', 'is_system'];

    protected $casts = [
        'is_system' => 'boolean',
    ];

    public function items(): HasMany
    {
        return $this->hasMany(DictionaryItem::class)->orderBy('sort');
    }
}
