<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class LeaveTypeMaster extends Model
{
    use SoftDeletes;

    protected $table = 'leave_type_master';
    protected $primaryKey = 'LT_id';

    const CREATED_AT = 'created_at';
    const UPDATED_AT = 'updated_at';
    const DELETED_AT = 'deleted_at';

    protected $fillable = [
        'LT_code',
        'LT_name',
        'Max_days',
        'Alw_Gen',
        'Min_ApBf',
        'Min_ApDy',
        'Max_ApDy',
        'Acr_Plcy',
        'Acr_Days',
        'Is_Encash',
        'Is_CryFw',
        'Max_CfAl',
        'Is_HfDy',
        'Is_Paid',
        'Is_Active',
        // 'Attn_type'
    ];

    protected $casts = [
        'LT_id' => 'integer',
        'Max_days' => 'integer',

        // ✅ Correct Types
        'Alw_Gen' => 'string',        // ENUM (M,F,A)
        'Min_ApBf' => 'integer',
        'Min_ApDy' => 'float',       // decimal(6,2)
        'Max_ApDy' => 'float',
        'Acr_Plcy' => 'string',
        'Acr_Days' => 'integer',
        'Is_Encash' => 'boolean',
        'Is_CryFw' => 'boolean',
        'Max_CfAl' => 'integer',
        'Is_HfDy' => 'boolean',

        'Is_Paid' => 'boolean',
        'Is_Active' => 'boolean',
        'Attn_type' => 'string',

        'created_at' => 'datetime',
        'updated_at' => 'datetime',
        'deleted_at' => 'datetime'
    ];
}
