<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * A single race-free counter, locked by AssetTagGenerator inside a transaction.
 *
 * One row per numbering scope — 'global', or a category code when the
 * `asset_tag_scope` setting is 'per_category'. Never touched anywhere except
 * inside AssetTagGenerator::next().
 *
 * @property int $id
 * @property string $scope_key
 * @property int $last_number
 */
class AssetTagSequence extends Model
{
    /** @var list<string> */
    protected $fillable = [
        'scope_key',
        'last_number',
    ];

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