<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class TaxType extends Model
{
    use HasFactory;

    protected $table = 'tax_types';

    protected $fillable = [
        'code',
        'tax_name_id',
        'category',
        'rate',
        'tax_base_type',
        'tax_base_formula',
        'status',
        'description',
        'legal_basis',
        'updated_date',
    ];

    protected $casts = [
        'rate' => 'double',
        'status' => 'boolean',
        'updated_date' => 'date',
    ];

    public function taxName()
    {
        return $this->belongsTo(TaxName::class, 'tax_name_id', 'id');
    }
}
