<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class LeaveType extends Model
{
    use BelongsToTenant;

    protected $fillable = ['tenant_id', 'name', 'code', 'annual_allocation', 'maximum_carry_forward', 'accrual_method', 'is_paid', 'requires_attachment', 'approval_levels', 'is_active'];

    protected $casts = ['annual_allocation' => 'decimal:2', 'maximum_carry_forward' => 'decimal:2', 'is_paid' => 'boolean', 'requires_attachment' => 'boolean', 'is_active' => 'boolean'];

    public function requests()
    {
        return $this->hasMany(LeaveRequest::class);
    }
}
