<?php

namespace App\Models;

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

class AttachmentGroup extends BaseModel
{
    protected $table = 'attachment_groups';

    public const CREATED_AT = 'create_time';

    public const UPDATED_AT = 'update_time';

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

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

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