<?php

namespace App\Models;

class OpeningBalance extends BaseModel
{
    protected $fillable = [
        'company_id',
        'entity_type',
        'entity_id',
        'warehouse_id',
        'balance',
        'quantity',
        'unit_cost',
        'as_of_date',
        'voucher_id',
        'dr_cr',
        'posted_amount',
    ];

    protected $casts = [
        'balance' => 'decimal:2',
        'quantity' => 'decimal:4',
        'unit_cost' => 'decimal:6',
        'as_of_date' => 'date',
        'posted_amount' => 'decimal:2',
    ];

    public function voucher()
    {
        return $this->belongsTo(Voucher::class);
    }
}
