<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ClientInvoiceGlAccount extends Model
{
    protected $table = 'client_invoice_gl_accounts';

    protected $fillable = [
        'invoice_id',
        'gl_account_id',
        'gl_account_code',
        'line_type',
        'description',
        'amount',
        'created_by',
        'updated_by',
    ];

    protected $casts = [
        'amount' => 'decimal:2',
    ];

    public function invoice()
    {
        return $this->belongsTo(ClientInvoice::class, 'invoice_id');
    }

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