<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class LoanInstallment extends Model
{
    use BelongsToTenant;

    protected $fillable = ['tenant_id', 'employee_loan_id', 'payroll_item_id', 'due_month', 'amount', 'status', 'deducted_at'];

    protected $casts = ['due_month' => 'date', 'amount' => 'decimal:2', 'deducted_at' => 'datetime'];

    public function loan()
    {
        return $this->belongsTo(EmployeeLoan::class, 'employee_loan_id');
    }
}
