using ERPCore.Domain.Enums;

namespace ERPCore.Domain.Entities;

/// <summary>
/// Loan installment ledger row. <see cref="PayrollRunId"/> is stamped only when the
/// consuming <see cref="PayrollRun"/> reaches Locked (docs/12-BACKEND-HRM.md A.4).
/// Model: docs/12-BACKEND-HRM.md Part C.6.
/// </summary>
public class LoanInstallment
{
    public int LoanInstallmentId { get; set; }
    public int EmployeeLoanId { get; set; }
    public EmployeeLoan? EmployeeLoan { get; set; }

    public int InstallmentNumber { get; set; }
    public int DueYear { get; set; }
    public int DueMonth { get; set; }
    public decimal ScheduledAmount { get; set; }
    public decimal? PaidAmount { get; set; }
    public int? PayrollRunId { get; set; }
    public PayrollRun? PayrollRun { get; set; }
    public LoanInstallmentStatus Status { get; set; } = LoanInstallmentStatus.Pending;

    public uint RowVersion { get; set; }
}
