<?php

namespace App\Models;

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

class TransDemand extends Model
{
    use SoftDeletes;

    protected $table = 'trans_demand';
    protected $primaryKey = 'Dmd_Id';

    protected $fillable = [
        'Prop_Id','Owner_ID','TxTy_ID','FY_Id',
        'Bill_No','Bill_Date','Due_Date',
        'Assessed_Area','Base_Amount',
        'Rebate_Amount','Penalty_Amount',
        'Net_Amount','Arrear_Amount','Total_Amount',
        'Demand_Type','Status', 'R_Status', 'Status_Remarks',
        'Generated_By','Remark', 'Approved_By'
    ];

    // Relations
    public function property() {
        return $this->belongsTo(PropertyMaster::class, 'Prop_Id', 'Prop_Id');
    }

    public function owner() {
        return $this->belongsTo(OwnerMaster::class, 'Owner_ID', 'Owner_ID');
    }

    public function taxType() {
        return $this->belongsTo(TaxTypeMaster::class, 'TxTy_ID', 'TxTy_ID');
    }

    public function financialYear() {
        return $this->belongsTo(FyearMaster::class, 'FY_Id', 'FY_Id');
    }

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

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

        public function Status() {
        return $this->belongsTo(ActionMaster::class, 'Status', 'Act_Id');
    }

          public function rStatus() {
        return $this->belongsTo(ActionMaster::class, 'R_Status', 'Act_Id');
    }
}
