import type { MultiplayerQuestion } from "../services/multiplayerGameService.js";

export type LobbyGameData = {
  code: string;
  questions: MultiplayerQuestion[];
  currentIndex: number;
  // NOTE: Map types are used here for O(1) lookups in-process.
  // When migrating to Valkey, convert to plain objects for JSON serialization.
  playerAnswers: Map<string, number | null>; // userId → selectedOptionId, null = timed out
  scores: Map<string, number>; // userId → running total
};

export interface LobbyGameStore {
  create(lobbyId: string, data: LobbyGameData): Promise<void>;
  get(lobbyId: string): Promise<LobbyGameData | null>;
  set(lobbyId: string, data: LobbyGameData): Promise<void>;
  delete(lobbyId: string): Promise<void>;
}
