namespace FinancialApi.Application; public record Account(int Id, decimal Balance) { public Account ApplyFee(decimal amount) { if (amount <= 0) { throw new ArgumentException("Fee must be positive."); } if (Balance - amount < 0) { throw new InvalidOperationException("Insufficient funds."); } return this with { Balance = Balance - amount }; } public Account Debit(decimal amount) { if (amount <= 0) { throw new ArgumentException("Debit amount must be positive."); } if (Balance - amount < 0) { throw new InvalidOperationException("Insufficient funds."); } return this with { Balance = Balance - amount }; } public Account Credit(decimal amount) { if (amount <= 0) { throw new ArgumentException("Credit amount must be positive."); } return this with { Balance = Balance + amount }; } }