<?php

namespace App\Models;

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

class AccountingVoucherLine extends Model
{
    use HasFactory;

    protected $guarded = ['id'];

    protected $casts = [
        'voucher_id' => 'integer',
        'account_id' => 'integer',
        'debit' => 'float',
        'credit' => 'float',
        'party_id' => 'integer',
    ];

    public function voucher()
    {
        return $this->belongsTo(AccountingVoucher::class, 'voucher_id');
    }

    public function account()
    {
        return $this->belongsTo(AccountingAccount::class, 'account_id');
    }
}
