<?php

namespace App\Models;

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

class EmpMonthlyPayroll extends Model
{
    use SoftDeletes;

    protected $table = 'emp_monthly_payroll';
    protected $primaryKey = 'Emp_MP_Id';

    protected $fillable = [
        'PRB_id',
        'Emp_Id',
        'FY_Id',
        'Month',
        'Year',
        'Emp_Sr',
        'Attn_Text',
        'Total_Presence',
        'Total_Holiday',
        'Total_WKOF_Pre',
        'Total_Absent',
        'Total_Duration',
        'Total_Over_Time',
        'Total_LateBy',
        'Total_EarlyBy'
    ];

    public $timestamps = true;

    // 🔗 Relations
    public function employee()
    {
        return $this->belongsTo(EmployeeMaster::class, 'Emp_Id', 'Emp_Id');
    }

    public function payrollBill()
    {
        return $this->belongsTo(PayrollBill::class, 'PRB_id', 'PRB_id');
    }

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