39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { GameSnapshotAggregate, SnapshotTrigger } from '../Game/GameSnapshotAggregate';
|
|
|
|
export interface IGameSnapshotRepository {
|
|
/**
|
|
* Save a game state snapshot
|
|
*/
|
|
save(snapshot: GameSnapshotAggregate): Promise<GameSnapshotAggregate>;
|
|
|
|
/**
|
|
* Get the most recent snapshot for a game
|
|
*/
|
|
findLatestByGameId(gameId: string): Promise<GameSnapshotAggregate | null>;
|
|
|
|
/**
|
|
* Get all snapshots for a game
|
|
*/
|
|
findByGameId(gameId: string): Promise<GameSnapshotAggregate[]>;
|
|
|
|
/**
|
|
* Get snapshots by trigger type
|
|
*/
|
|
findByGameAndTrigger(gameId: string, trigger: SnapshotTrigger): Promise<GameSnapshotAggregate[]>;
|
|
|
|
/**
|
|
* Get snapshot at specific turn
|
|
*/
|
|
findByGameAndTurn(gameId: string, turnNumber: number): Promise<GameSnapshotAggregate | null>;
|
|
|
|
/**
|
|
* Delete old snapshots (keep only last N)
|
|
*/
|
|
deleteOldSnapshots(gameId: string, keepCount: number): Promise<void>;
|
|
|
|
/**
|
|
* Delete all snapshots for a game
|
|
*/
|
|
deleteByGameId(gameId: string): Promise<void>;
|
|
}
|