<?php

namespace App\Models\Finance;

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

class VatRecord extends Model
{
    use SoftDeletes;

    protected $table = 'vat_records';

    protected $fillable = [
        'tenant_id',
        'period',
        'type',
        'tax_type',
        'partner_name',
        'invoice_no',
        'invoice_date',
        'supply_amount',
        'vat_amount',
        'total_amount',
        'status',
        'memo',
    ];

    protected $casts = [
        'invoice_date' => 'date',
        'supply_amount' => 'integer',
        'vat_amount' => 'integer',
        'total_amount' => 'integer',
    ];

    public function scopeForTenant($query, $tenantId)
    {
        return $query->where('tenant_id', $tenantId);
    }
}
