import { type CurrencyDefinition } from "../economy/currency.js"; /** * Everything a career bank stores, as plain JSON. `banked` is the persistent balance; `haul` is * the run in progress and is the part a failed run loses. `deposited`, `lost`, `bestHaul` and * `runs` are lifetime counters a results screen reads. */ export interface CareerBankState { banked: number; haul: number; deposited: number; lost: number; bestHaul: number; runs: number; } /** Configuration for {@link createCareerBank}. */ export interface CareerBankConfig { currency: CurrencyDefinition; /** Persistent money before any run (default `0`). */ start?: number; /** Most a single run's haul can carry; omitted means no cap. */ haulCap?: number; /** Rehydrate from a prior {@link CareerBank.snapshot}. */ state?: CareerBankState; } /** Persistent career money plus the run in progress, which a failed run loses. */ export interface CareerBank { currency(): CurrencyDefinition; /** Money kept between runs. */ banked(): number; /** Money earned this run and not yet banked or lost. */ haul(): number; /** Add to the run's haul (capped by `haulCap`); negative or non-finite is ignored. Returns the haul. */ earn(amount: number): number; /** Bank the haul: it becomes persistent and the run's haul resets. */ cashOut(): { deposited: number; banked: number; }; /** The run failed: the haul is gone, persistent money is untouched. */ loseHaul(): { lost: number; banked: number; }; /** Pay from persistent money; `false` when it cannot cover the amount. */ spend(amount: number): boolean; afford(amount: number): boolean; counters(): { deposited: number; lost: number; bestHaul: number; runs: number; }; snapshot(): CareerBankState; restore(next: CareerBankState): void; } /** * Money that means something between runs: a persistent balance plus a run's haul that is banked on * a cash-out and lost on a failure. Amounts are snapped to the currency's minor units, so a save * round-trip and a display never drift. Pair it with `economy/upgrades` for a career upgrade tree. * * @capability career-bank persistent career money with a run haul that can be banked or lost */ export declare function createCareerBank(config: CareerBankConfig): CareerBank;