namespace General_Ledger_Service.Models { public class BankAccount { public long BankAccountId { get; set; } public string AccountName { get; set; } = string.Empty; public string? BankName { get; set; } public string? AccountNumber { get; set; } public long GlAccountId { get; set; } public string CurrencyCode { get; set; } = string.Empty; public DateTime CreatedAt { get; set; } public Account GlAccount { get; set; } = null!; public Currency Currency { get; set; } = null!; } public class BankStatementLine { public long StmtLineId { get; set; } public long BankAccountId { get; set; } public DateOnly TxnDate { get; set; } public string? Description { get; set; } public decimal Amount { get; set; } public bool IsReconciled { get; set; } public long? MatchedJournalId { get; set; } public DateTime CreatedAt { get; set; } public BankAccount BankAccount { get; set; } = null!; public JournalEntry? MatchedJournal { get; set; } } // Separate from BankAccount - a cash account is not a bank account, just the same "level" // of concept (both are cash-and-bank master data referencing a GL account), decided // 2026-07-22 after starting from (and rejecting) a single-table CASH/BANK discriminator. public class CashAccount { public long CashAccountId { get; set; } public string AccountName { get; set; } = string.Empty; public int CashAccountTypeId { get; set; } public string AccountNumber { get; set; } = string.Empty; public long GlAccountId { get; set; } public string CurrencyCode { get; set; } = string.Empty; public bool IsActive { get; set; } = true; // Exactly one CashAccount is ever marked default — seeded once (BankService's seed // check) so there is always at least one cash account to fall back to. Protected from // delete/deactivate (BankService.UpdateCashAccountStatusAsync/DeleteCashAccountAsync); // only its AccountName may be changed. public bool IsDefault { get; set; } public DateTime CreatedAt { get; set; } public CashAccountType CashAccountType { get; set; } = null!; public Account GlAccount { get; set; } = null!; public Currency Currency { get; set; } = null!; } // Grows at runtime - creating a CashAccount with a cashAccountTypeName not already present // here causes a new row to be added on the fly (BankService.CreateCashAccountAsync), so it // appears in the list for future selections without a migration. public class CashAccountType { public int CashAccountTypeId { get; set; } public string Name { get; set; } = string.Empty; // Nullable - existing rows (incl. the seeded Petty Cash/Till Cash/Safe Cash/Cash in // Transit types) predate this column. BankService.CreateCashAccountAsync lazily creates // and backfills this the first time a type is used to back a new cash account (retrofit // 2026-07-31) - the GL node for a type that's never been used yet simply doesn't exist. public long? GlAccountId { get; set; } public DateTime CreatedAt { get; set; } public Account? GlAccount { get; set; } } }