<?php

namespace Modules\Accounts\Models;

use Illuminate\Database\Eloquent\Model;
use Modules\Accounts\Models\Traits\HasAccount;
use Modules\Core\Enums\VatTypeEnum;

class VatTransaction extends Model
{
    use HasAccount;

    protected $fillable = [
        'transaction_date',
        'source_type',
        'source_id',
        'transaction_type',
        'itemable_type',
        'itemable_id',
        'taxable_amount',
        'vat_type',
        'vat_rate',
        'vat_amount',
        'account_id',
        'fiscal_year_id',
        'accounting_period_id',
        'is_settled',
        'vat_settlement_id'
    ];

    protected $casts = [
        'transaction_date' => 'date',
        'vat_type' => VatTypeEnum::class,
        'is_settled' => 'boolean',
        'taxable_amount' => 'decimal:2',
        'vat_rate' => 'decimal:2',
        'vat_amount' => 'decimal:2',
    ];
}
