# WalletLoans

OTP application managing loan lifecycle within the MercuryPay umbrella.

## Public Interface

```elixir
# Loan management
WalletLoans.LoanStore.store(loan)
WalletLoans.LoanStore.get(loan_id)
WalletLoans.LoanStore.update(loan)
WalletLoans.LoanStore.list_by_user(user_id)
WalletLoans.LoanStore.list_all()

# Loan calculations
WalletLoans.Calculator.compute_schedule(principal, rate, term_months)
WalletLoans.Calculator.outstanding_balance(loan)
```

## Responsibilities
- Loan application submission and approval lifecycle.
- Repayment schedule computation and tracking.
- Loan status management: pending → active → repaid / defaulted.

## Forbidden Dependencies
- **wallet_ledger** — no direct ledger writes from this app.
- **wallet_auth** — no auth logic in this app.
- **wallet_accounts** — does not own account state.

## Dependencies
- `wallet_shared_kernel` — TypedId, Money, Correlation.
- `wallet_observability` — AuditEvent, Telemetry.
- `wallet_events` — DomainEvent behaviour.
- `wallet_database` — write-through persistence (LoanPersistence).

## TypedId Prefix
- `loan_` — wallet loans.

## Events Emitted
- `WalletLoans.Events.LoanApplicationSubmitted.v1`
- `WalletLoans.Events.RepaymentMade.v1`

## Store
`WalletLoans.LoanStore` — ETS-backed GenServer; MySQL write-through via `LoanPersistence`.
