import { type CommitController, type CommitMode } from "./commit.js"; export type { CommitMode, CommitController } from "./commit.js"; export interface PoolConfig { id: string; max: number; start?: number; } export interface TurnLoopConfig { order: readonly string[]; phases?: readonly string[]; pools?: readonly PoolConfig[]; commit?: { mode: CommitMode; }; onTurnStart?(participantId: string): void; onTurnEnd?(participantId: string): void; } export interface PoolState { id: string; current: number; max: number; } export interface TurnState { round: number; order: readonly string[]; activeIndex: number; active: string | null; phaseIndex: number; phase: string | null; } export interface TurnLoopSnapshot { round: number; order: string[]; activeIndex: number; phaseIndex: number; pools: Record>; } export interface TurnLoop { readonly commit: CommitController; state(): TurnState; order(): readonly string[]; active(): string | null; phase(): string | null; round(): number; setOrder(order: readonly string[], keepActive?: boolean): TurnState; addParticipant(id: string, atIndex?: number): TurnState; removeParticipant(id: string): TurnState; advancePhase(): TurnState; advanceTurn(): TurnState; advanceRound(): TurnState; pools(participantId: string): PoolState[]; pool(participantId: string, poolId: string): PoolState | null; canSpend(participantId: string, poolId: string, amount?: number): boolean; spend(participantId: string, poolId: string, amount?: number): boolean; gain(participantId: string, poolId: string, amount: number): boolean; refill(participantId: string, poolId?: string): void; capture(): TurnLoopSnapshot; restore(snapshot: TurnLoopSnapshot): void; } export declare function createTurnLoop(config: TurnLoopConfig): TurnLoop;