<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\HasMany;

class IncomeTaxPlan extends Model
{
    protected $table = 'income_tax_plans';

    protected $fillable = [
        'plan_name',
        'plan_code',
        'allow_deductions',
        'standard_deduction',
        'description',
        'effective_from',
        'effective_to',
        'is_active',
    ];

    protected $casts = [
        'allow_deductions' => 'boolean',
        'is_active' => 'boolean',
        'effective_from' => 'date',
        'effective_to' => 'date',
        'standard_deduction' => 'decimal:2',
    ];

    public function taxSlabs(): HasMany
    {
        return $this->hasMany(TaxSlab::class, 'plan_id')->orderBy('slab_no');
    }
}
