/**
 * Game Bridge
 * Wrapper đơn giản cho game developers để giao tiếp với SDK Iframe
 *
 * Usage:
 * ```typescript
 * import { GameBridge } from 'game-iframe-sdk/game-bridge';
 *
 * const bridge = new GameBridge({
 *     sdkIframeUrl: 'https://sdk.sena.tech/sdk-iframe.html',
 *     debug: true,
 * });
 *
 * // Init
 * await bridge.init({
 *     mode: 'preview',
 *     game_code: 'G001',
 * });
 *
 * // Listen for data
 * bridge.on('dataReady', (data) => {
 *     renderGame(data.items);
 * });
 *
 * // Check answer
 * bridge.checkAnswer('q1', userChoice).then(result => {
 *     showFeedback(result.correct);
 * });
 * ```
 */
import { SdkInitPayload, SdkPushDataPayload, SdkReadyPayload, SdkDataReadyPayload, SdkAnswerResultPayload, SdkSyncStatusPayload, SdkSyncErrorPayload, SdkFinalResultPayload, SdkErrorPayload } from '../sdk-iframe/types';
export interface GameBridgeConfig {
    sdkIframeUrl: string;
    debug?: boolean;
    timeout?: number;
}
export interface GameBridgeEvents {
    ready: SdkReadyPayload;
    dataReady: SdkDataReadyPayload;
    answerResult: SdkAnswerResultPayload;
    syncStatus: SdkSyncStatusPayload;
    syncError: SdkSyncErrorPayload;
    finalResult: SdkFinalResultPayload;
    error: SdkErrorPayload;
}
type EventHandler<T> = (data: T) => void;
export declare class GameBridge {
    private config;
    private sdkIframe;
    private sdkOrigin;
    private isReady;
    private handlers;
    private pendingRequests;
    private requestCounter;
    constructor(config: GameBridgeConfig);
    /**
     * Create SDK Iframe and initialize
     */
    init(payload: SdkInitPayload): Promise<SdkReadyPayload>;
    /**
     * Push data (preview mode)
     */
    pushData(payload: SdkPushDataPayload): Promise<SdkDataReadyPayload>;
    /**
     * Check answer - returns local result immediately
     * Also triggers server sync in background
     */
    checkAnswer(questionId: string, choice: any, timeSpent?: number): Promise<SdkAnswerResultPayload>;
    /**
     * Get final result
     */
    getFinalResult(): Promise<SdkFinalResultPayload>;
    /**
     * Retry sync for a question
     */
    retrySync(questionId: string): Promise<SdkSyncStatusPayload>;
    /**
     * Subscribe to events
     */
    on<K extends keyof GameBridgeEvents>(event: K, handler: EventHandler<GameBridgeEvents[K]>): () => void;
    /**
     * Unsubscribe from events
     */
    off<K extends keyof GameBridgeEvents>(event: K, handler: EventHandler<GameBridgeEvents[K]>): void;
    /**
     * Check if SDK is ready
     */
    isSdkReady(): boolean;
    /**
     * Destroy bridge and cleanup
     */
    destroy(): void;
    private setupMessageListener;
    private handleMessage;
    private emit;
    private sendRequest;
    private log;
}
/**
 * Get or create GameBridge instance
 */
export declare function getGameBridge(config?: GameBridgeConfig): GameBridge;
/**
 * Destroy GameBridge instance
 */
export declare function destroyGameBridge(): void;
export {};
//# sourceMappingURL=GameBridge.d.ts.map