<?php

namespace App\Models;

use App\Enums\ModuleType;
use App\Models\Traits\Filterable;
use App\Models\Traits\SelectOptions;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class CodeConfig extends Model
{
  use HasFactory, Filterable, SelectOptions;

  protected $fillable = [
    'module',
    'prefix',
    'separator',
    'digits',
    'last_number',
    'is_user_alias',
  ];

  protected $casts = [
    // 'module' => ModuleType::class, 
    // Not casting module to Enum yet because it might be a string key in config lookup, keeping it flexible.
    // Actually migration sets default from Enum, so it matches. But let's check validation needs.
    // Plan says: `module` (string, default: ModuleType::Budget, unique).
    // It should probably be cast for type safety if we use the Enum in code.
    'module' => ModuleType::class,
    'is_user_alias' => 'boolean',
  ];
}
