import apiClient from './client'; export interface ContestInfo { id: number; slug: string; name: string; description: string | null; prize_days: number; is_available: boolean; already_played: boolean; } export interface ContestGameData { round_id: number; game_type: string; // Dynamic game data from backend - shape depends on game_type // eslint-disable-next-line @typescript-eslint/no-explicit-any game_data: Record; instructions: string; } export interface ContestResult { is_winner: boolean; message: string; prize_days?: number; } export interface ContestsCountResponse { count: number; } export const contestsApi = { // Get count of available contests getCount: async (): Promise => { const response = await apiClient.get('/cabinet/contests/count'); return response.data; }, // Get list of available contests getContests: async (): Promise => { const response = await apiClient.get('/cabinet/contests'); return response.data; }, // Get game data for a specific contest getContestGame: async (roundId: number): Promise => { const response = await apiClient.get(`/cabinet/contests/${roundId}`); return response.data; }, // Submit answer for a contest submitAnswer: async (roundId: number, answer: string): Promise => { const response = await apiClient.post(`/cabinet/contests/${roundId}/answer`, { round_id: roundId, answer, }); return response.data; }, };