<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class Account extends Model
{
    use BelongsToTenant;

    protected $table = 'chart_of_accounts';

    protected $fillable = [
        'tenant_id',
        'account_code',
        'account_name',
        'account_type',
        'parent_code',
        'is_clearing',
        'is_system',
        'status',
    ];

    protected $casts = [
        'is_clearing' => 'boolean',
        'is_system' => 'boolean',
    ];

    public function journalItems()
    {
        return $this->hasMany(JournalItem::class, 'account_id');
    }
}
