<?php

declare(strict_types=1);

namespace Modules\{{ Module }}\Models;

use App\Support\Concerns\Auditable;
use App\Support\Concerns\BelongsToBranch;
use App\Support\Concerns\HasUlid;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Data mapping only. No business rules, no notifications, no static finders
 * used as a service layer — those belong in {{ Entity }}Service.
 *
 * @property int $id
 * @property string $ulid
 * @property int $branch_id
 * @property string $name
 */
final class {{ Entity }} extends Model
{
    use Auditable;
    use BelongsToBranch;
    use HasUlid;
    use SoftDeletes;

    protected $table = '{{ table }}';

    /**
     * An explicit allow-list. `$guarded = []` is never acceptable here: a
     * request array reaching fill() is how branch_id or a status column gets
     * overwritten by a crafted form post.
     *
     * @var list<string>
     */
    protected $fillable = [
        'branch_id',
        'name',
    ];

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