import { DEFAULT_CHIP_AMOUNTS, DEFAULT_GAME_CHIP_COLORS, GAME_MAX_SELECTION_CELLS, } from '@/constants' import type { AnnouncementState, Chip, ConnectionState, DashboardState, GameBootstrapSnapshot, RoundSnapshot, } from '@/type' function createEmptyRoundSnapshot(nowIso: string): RoundSnapshot { return { bettingClosesAt: nowIso, id: '', phase: 'waiting', revealingAt: nowIso, settledAt: null, startedAt: nowIso, winningCellId: null, } } function createEmptyAnnouncementState(): AnnouncementState { return { activeAnnouncementId: null, items: [], lastUpdatedAt: null, } } function createEmptyConnectionState(): ConnectionState { return { connectedAt: null, lastError: null, lastMessageAt: null, latencyMs: null, reconnectAttempt: 0, status: 'idle', transport: 'offline', } } function createEmptyDashboardState(nowIso: string): DashboardState { return { countdownMs: 0, featuredCellId: null, jackpotPool: null, onlinePlayers: 0, tableLimitMax: 0, tableLimitMin: 0, totalPoolAmount: 0, updatedAt: nowIso, } } function createDefaultChips(): Chip[] { return DEFAULT_CHIP_AMOUNTS.map((chip, index) => ({ amount: chip.amount, color: DEFAULT_GAME_CHIP_COLORS[index] ?? DEFAULT_GAME_CHIP_COLORS[0], id: chip.id, isDefault: chip.id === 'chip-5', label: String(chip.amount), })) } export function createEmptyGameBootstrapSnapshot( nowIso = new Date().toISOString(), ): GameBootstrapSnapshot { return { announcements: createEmptyAnnouncementState(), cells: [], chips: createDefaultChips(), connection: createEmptyConnectionState(), dashboard: createEmptyDashboardState(nowIso), history: [], maxSelectionCount: GAME_MAX_SELECTION_CELLS, round: createEmptyRoundSnapshot(nowIso), selections: [], trends: [], } }