<?php

namespace App\Models;

use App\Enums\Status;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Relations\HasMany;

class ConfigGroup extends BaseModel
{
    protected $table = 'config_groups';

    public const CREATED_AT = 'create_time';

    public const UPDATED_AT = 'update_time';

    protected $fillable = [
        'name',
        'code',
        'app_id',
        'sort',
        'status',
    ];

    protected $casts = [
        'status' => Status::class,
    ];

    public function items(): HasMany
    {
        return $this->hasMany(ConfigItem::class, 'group_id');
    }
}
