<?php

namespace App\Models;

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

class TenderAdjustment extends Model
{
    use SoftDeletes;

    protected $table = 'tender_adjustments';
    protected $primaryKey = 'TA_Id';

    protected $fillable = [
        'WA_Id',
        'SL_Id',
        'Lg_Id',
        'TA_Date',
        'Fix_Per',
        'WO_Amount',
        'Percentage',
        'Adj_Amount',
        'Add_Deduct',
        'Bill_No',
        'Status',
        'Remarks',
        'HOD_Approved',
        'HOD_Reject',
        'HOD_Officer'
    ];


    public function subledger()
    {
        return $this->belongsTo(SubLedgerMaster::class, 'SL_Id', 'SL_Id'); // Updated class name
    }

    public function workAllocation()
    {
        return $this->belongsTo(WorkAllocationBook::class, 'WA_Id', 'WA_Id');
    }

    public function hodOfficer()
    {
        return $this->belongsTo(UserMaster::class, 'HOD_Officer', 'Usr_Id');
    }

    public function ledger()
    {
        return $this->belongsTo(LedgerMaster::class, 'Lg_Id', 'Lg_Id');
    }
}
