<?php

namespace App\Models;

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

class PropertyAssessment extends Model
{
    use SoftDeletes;

    protected $table = 'property_assessments';
    protected $primaryKey = 'Asmnt_Id';

    protected $fillable = [
        'Prop_Id',
        'FY_Id',
        // 'Inspector_Id',
        'Asmnt_Date',
        'Old_Area',
        'New_Area',
        'Old_Usage',
        'New_Usage',
        'Old_Const',
        'New_Const',
        'Reason',
        'Status',
        'R_Status',
        'Status_Remarks',
        'Generated_By',
        'Approved_By',
        'Approved_At'
    ];

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

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

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

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

     public function generateBy()
    {
        return $this->belongsTo(UserMaster::class,'Generated_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');
    }
}
