import { TrackType } from '../gen/video/sfu/models/models';
import type { StreamClient } from '../coordinator/connection/client';
import type { PeerConnectionStateChangeEvent } from '../rtc';
export type ClientEventPeerConnection = 'publish' | 'subscribe';
export type ClientEventStage = 'JoinInitiated' | 'CoordinatorWS' | 'MediaDevicePermission' | 'CoordinatorJoin' | 'WSJoin' | 'PeerConnectionConnect' | 'FirstVideoFrame' | 'FirstAudioFrame';
export type MediaPermissionState = 'INITIATED' | 'FAILED' | 'GRANTED' | 'NOT_INITIATED';
export type JoinReason = 'first-attempt' | 'network-available' | 'migration' | 'full-rejoin';
export type ClientEventStandardCode = 'CLIENT_ABORTED' | 'BACKEND_LEAVE' | 'REQUEST_TIMEOUT' | 'NETWORK_ERROR' | 'SFU_ERROR' | 'SFU_GO_AWAY' | 'ICE_CONNECTIVITY_FAILED' | 'DTLS_CONNECTIVITY_FAILED';
export type CallReportContext = {
    callType: string;
    callId: string;
    getSfuId: () => string;
    getCallSessionId: () => string;
    getUserSessionId: () => string;
};
export type ClientEventReporterOptions = {
    streamClient: StreamClient;
    enabled?: boolean;
};
export declare class ClientEventReporter {
    private readonly logger;
    private streamClient;
    private enabled;
    private coordinatorConnectId?;
    private coordinatorConnectUserId?;
    private coordinatorWsPair?;
    private callContexts;
    private joinAttemptIds;
    private joinReasons;
    private coordinatorPairs;
    private wsPairs;
    private peerConnectionPairs;
    private pcEverConnected;
    private firstFrameReported;
    constructor(options: ClientEventReporterOptions);
    /**
     * Starts a new coordinator connection correlation scope.
     *
     * @param userId the id of the user being connected. Captured here because
     * the `CoordinatorWS` stage emits before the connection flow assigns
     * the user to the client, so it can't be read from the client yet.
     */
    startCoordinatorConnection: (userId?: string) => string;
    trackCoordinatorWs: <T>(op: () => Promise<T>) => Promise<T>;
    private beginCoordinatorWs;
    private succeedCoordinatorWs;
    closeCoordinatorWs: () => void;
    private buildCoordinatorWsCommon;
    private emitMediaPermission;
    registerCall: (cid: string, ctx: CallReportContext) => void;
    unregisterCall: (cid: string) => void;
    startCorrelation: (cid: string, joinReason: JoinReason) => void;
    withJoinLifecycle: <T>(cid: string, joinReason: JoinReason, op: () => Promise<T>) => Promise<T>;
    track: <T>(cid: string, stage: "CoordinatorJoin" | "WSJoin", op: () => Promise<T>) => Promise<T>;
    reportFirstFrame: (cid: string, trackType: TrackType, trackId: string) => void;
    captureWsError: (cid: string, opts: {
        code: string;
        reason: string;
    }) => void;
    close: (cid: string) => void;
    abort: (cid: string, opts: {
        code: "CLIENT_ABORTED" | "BACKEND_LEAVE";
        reason: string;
    }) => void;
    private closeCallPairs;
    private emitJoinInitiated;
    private beginAttempt;
    private succeedAttempt;
    private applyStageError;
    private beginCoordinatorAttempt;
    private succeedCoordinator;
    private failCoordinator;
    private beginWsAttempt;
    private succeedWs;
    private failWs;
    onPeerConnectionStateChange: (cid: string, event: PeerConnectionStateChangeEvent) => void;
    private openPeerConnectionPair;
    private emitPeerConnectionSuccess;
    private emitPeerConnectionFailure;
    private getSfuId;
    private getUserSessionId;
    private sessionIdField;
    private buildCommon;
    private send;
    private sendForCall;
    private sendWithRetry;
}
