/**
 * GameClientSDK - SDK dành cho Game Iframe
 *
 * Sử dụng trong game để:
 * - Tự động xác định mode (preview/live) từ URL
 * - Nhận data từ parent (preview) hoặc fetch API (live)
 * - Verify answers locally
 * - Report results về parent
 */
import { GameCode } from '../kit/GameDataHandler';
import { ValidationResult } from './DataValidator';
export type ClientMode = 'preview' | 'live' | 'dev';
export interface ClientSDKConfig {
    debug?: boolean;
    apiBaseUrl?: string;
    getAuthHeaders?: () => Record<string, string>;
}
export interface URLParams {
    mode: ClientMode;
    gameCode: GameCode;
    gameId?: string;
    lid?: string;
    studentId?: string;
}
export interface GameDataPayload {
    game_id: string;
    game_code: GameCode;
    data: any[];
    completed_question_ids?: Array<{
        id: string;
        result: 0 | 1;
    }>;
}
export interface AnswerResult {
    isCorrect: boolean;
    score: number;
    feedback?: string;
}
export interface FinalResult {
    score: number;
    total: number;
    correct: number;
    wrong: number;
    details: Array<{
        question_id: string;
        choice: any;
        result: 0 | 1;
        time_spent: number;
    }>;
}
export interface ClientSDKEvents {
    ready: void;
    dataReceived: {
        items: any[];
        resumeData?: any[];
        validation?: ValidationResult;
    };
    error: {
        message: string;
        error?: any;
    };
    modeDetected: {
        mode: ClientMode;
        params: URLParams;
    };
    validationError: {
        validation: ValidationResult;
    };
}
type EventHandler<T> = (data: T) => void;
declare class SimpleEventEmitter<Events extends Record<string, any>> {
    private handlers;
    on<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): () => void;
    off<K extends keyof Events>(event: K, handler: EventHandler<Events[K]>): void;
    protected emit<K extends keyof Events>(event: K, data: Events[K]): void;
}
export declare class GameClientSDK extends SimpleEventEmitter<ClientSDKEvents> {
    private config;
    private params;
    private mode;
    private originalItems;
    private sanitizedItems;
    private userAnswers;
    private isInitialized;
    private startTime;
    constructor(config?: ClientSDKConfig);
    /**
     * Get current mode
     */
    getMode(): ClientMode;
    /**
     * Get URL params
     */
    getParams(): URLParams;
    /**
     * Get game code
     */
    getGameCode(): GameCode;
    /**
     * Get sanitized items (safe for rendering)
     */
    getItems(): any[];
    /**
     * Submit an answer and get verification result
     */
    submitAnswer(questionId: string, choice: any): AnswerResult;
    /**
     * Get final result
     */
    getFinalResult(): FinalResult;
    /**
     * Report final result to parent
     */
    reportFinalResult(result?: FinalResult): void;
    /**
     * Request leaderboard from parent
     */
    requestLeaderboard(top?: number): void;
    /**
     * Cleanup
     */
    destroy(): void;
    private parseURLParams;
    private setupMessageListener;
    private handleMessage;
    private initialize;
    /**
     * Load mock data for dev mode
     */
    private loadMockData;
    private sendGameReady;
    private fetchLiveData;
    private handleDataReceived;
    private sendAnswerReport;
    private log;
}
/**
 * Get or create GameClientSDK instance
 */
export declare function getGameClientSDK(config?: ClientSDKConfig): GameClientSDK;
/**
 * Destroy client instance
 */
export declare function destroyGameClientSDK(): void;
export {};
//# sourceMappingURL=GameClientSDK.d.ts.map