# WalletInsurance

OTP application managing insurance product catalog and customer policy lifecycle within the MercuryPay umbrella.

## Public Interface

```elixir
# Policy management
WalletInsurance.PolicyStore.store(policy)
WalletInsurance.PolicyStore.get(policy_id)
WalletInsurance.PolicyStore.update(policy)
WalletInsurance.PolicyStore.list_by_user(user_id)
WalletInsurance.PolicyStore.list_all()

# Product catalog
WalletInsurance.ProductStore.store(product)
WalletInsurance.ProductStore.get(product_id)
WalletInsurance.ProductStore.list_all()
WalletInsurance.ProductStore.list_available()
WalletInsurance.ProductStore.update(product)
```

## Responsibilities
- Insurance product catalog management (available products, pricing, coverage).
- Customer policy lifecycle: pending → active → expired / cancelled.
- Premium payment scheduling and renewal tracking.

## 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 (InsurancePolicyPersistence, InsuranceProductPersistence).

## TypedId Prefixes
- `pol_` — insurance policies.
- `iprod_` — insurance products.

## Events Emitted
- `WalletInsurance.Events.PolicyRenewed.v1`
- `WalletInsurance.Events.PremiumPaymentInitiated.v1`

## Stores
- `WalletInsurance.PolicyStore` — ETS-backed GenServer; MySQL write-through via `InsurancePolicyPersistence`.
- `WalletInsurance.ProductStore` — ETS-backed GenServer; MySQL write-through via `InsuranceProductPersistence`.
