using System.ComponentModel.DataAnnotations.Schema; namespace Distribution.Models { public class Payment : Template { public Guid FK_InvoiceId { get; set; } [ForeignKey("FK_InvoiceId")] public Invoice Invoice { get; set; } public decimal Amount { get; set; } public PaymentMethod Method { get; set; } public EntryMode EntryMode { get; set; } = EntryMode.RealTime; public string? ChequeNumber { get; set; } public DateTime? ChequeDate { get; set; } public DateTime CollectedAt { get; set; } public Guid CollectedBy { get; set; } public Guid? RecordedBy { get; set; } // Cash/Bank account that received the funds. Required when Method = Cash; // for Cheque, the FK_ReceivedCheque below carries the deposit account once deposited. public Guid? FK_BankAccountId { get; set; } [ForeignKey("FK_BankAccountId")] public BankAccount? BankAccount { get; set; } // Cheque record auto-created when Method = Cheque. Null for Cash/Credit payments. public Guid? FK_ReceivedChequeId { get; set; } [ForeignKey("FK_ReceivedChequeId")] public ReceivedCheque? ReceivedCheque { get; set; } } }