<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class StaffLoanDeduction extends Model
{
    protected $fillable = [
        'staff_loan_id', 'employee_id', 'month_number', 'due_date',
        'deduction_amount', 'principal_portion', 'interest_portion',
        'status', 'deducted_on', 'notes',
    ];

    protected $casts = [
        'deduction_amount'  => 'decimal:2',
        'principal_portion' => 'decimal:2',
        'interest_portion'  => 'decimal:2',
        'due_date'          => 'date',
        'deducted_on'       => 'date',
    ];

    public function staffLoan() { return $this->belongsTo(StaffLoan::class); }
    public function employee()  { return $this->belongsTo(Employee::class); }
}
