import type { AnyCreature, BestiaryIndex, CreatureId, Encounter, Pf2eBestiaryIndex, PlayerCharacter, UndoRedoState, } from "@initiative/domain"; export interface EncounterPersistence { readonly load: () => Encounter | null; readonly save: (encounter: Encounter) => void; } export interface UndoRedoPersistence { readonly load: () => UndoRedoState; readonly save: (state: UndoRedoState) => void; } export interface PlayerCharacterPersistence { readonly load: () => PlayerCharacter[]; readonly save: (characters: PlayerCharacter[]) => void; } export interface CachedSourceInfo { readonly sourceCode: string; readonly displayName: string; readonly creatureCount: number; readonly cachedAt: number; } export interface BestiaryCachePort { readonly cacheSource: ( system: string, sourceCode: string, displayName: string, creatures: AnyCreature[], ) => Promise; readonly isSourceCached: ( system: string, sourceCode: string, ) => Promise; readonly getCachedSources: (system?: string) => Promise; readonly clearSource: (system: string, sourceCode: string) => Promise; readonly clearAll: () => Promise; readonly loadAllCachedCreatures: () => Promise>; } export interface BestiaryIndexPort { readonly loadIndex: () => BestiaryIndex; readonly getAllSourceCodes: () => string[]; readonly getDefaultFetchUrl: (sourceCode: string, baseUrl?: string) => string; readonly getSourceDisplayName: (sourceCode: string) => string; } export interface Pf2eBestiaryIndexPort { readonly loadIndex: () => Pf2eBestiaryIndex; readonly getAllSourceCodes: () => string[]; readonly getDefaultFetchUrl: (sourceCode: string, baseUrl?: string) => string; readonly getSourceDisplayName: (sourceCode: string) => string; readonly getCreaturePathsForSource: (sourceCode: string) => string[]; readonly getCreatureNamesByPaths: (paths: string[]) => Map; }