import Database from 'better-sqlite3'; import { Encounter } from '../../schema/encounter.js'; /** * EncounterRepository - Persistence layer for combat encounters * * PHASE 1: Position Persistence * - Positions are stored within the tokens JSON * - Terrain obstacles are stored in a separate terrain column * - Grid bounds define valid coordinate ranges * * Storage format: * - tokens: JSON array of TokenSchema (includes position, movementSpeed, size) * - terrain: JSON object with obstacles and difficultTerrain arrays * - grid_bounds: JSON object with minX, maxX, minY, maxY, minZ?, maxZ? */ export declare class EncounterRepository { private db; constructor(db: Database.Database); /** * Ensure the encounters table has all required columns * This handles migration for existing databases */ private ensureSchema; create(encounter: Encounter): void; findByRegionId(regionId: string): Encounter[]; /** * Save combat state to database * PHASE 1: Now persists positions, terrain, and grid bounds * * @param encounterId The encounter ID * @param state The CombatState object (includes participants with positions) */ saveState(encounterId: string, state: any): void; /** * Load combat state from database * PHASE 1: Now restores positions, terrain, and grid bounds * * @param encounterId The encounter ID * @returns CombatState object with all spatial data, or null if not found */ loadState(encounterId: string): any | null; findById(id: string): EncounterRow | undefined; delete(id: string): boolean; } interface EncounterRow { id: string; region_id: string | null; tokens: string; round: number; active_token_id: string | null; status: string; terrain: string | null; props: string | null; grid_bounds: string | null; created_at: string; updated_at: string; } export {}; //# sourceMappingURL=encounter.repo.d.ts.map