/**
 * Translation Consumer Switch Utilities
 *
 * Provides functions to switch between original audio and translated audio
 * by pausing/resuming the appropriate consumers.
 *
 * Key concepts:
 * - When a user subscribes to a translation, the original audio consumer should be paused
 * - When translation stops or user unsubscribes, resume the original audio consumer
 * - Translation producers are consumed via the regular pipe producer flow (newPipeProducer)
 * - We just need to pause/resume the original audio consumers
 * - IMPORTANT: Must respect breakout room state - don't resume audio for speakers not in our room
 *
 * The consumer transports array contains objects with:
 * - consumerTransport: The mediasoup Transport object
 * - serverConsumerTransportId: ID on the server
 * - producerId: The producer being consumed
 * - consumer: The mediasoup Consumer object
 * - socket_: The socket used for this transport
 */
import { Transport, BreakoutParticipant, Participant, EventType } from "../@types/types";
export interface TranslationConsumerSwitchParameters {
    consumerTransports: Transport[];
    roomName: string;
    member: string;
    updateConsumerTransports: (transports: Transport[]) => void;
    breakOutRoomStarted?: boolean;
    breakOutRoomEnded?: boolean;
    breakoutRooms?: BreakoutParticipant[][];
    limitedBreakRoom?: BreakoutParticipant[];
    participants?: Participant[];
    ref_participants?: Participant[];
    islevel?: string;
    eventType?: EventType;
    hostNewRoom?: number;
    [key: string]: any;
}
export interface PauseOriginalProducerOptions {
    originalProducerId: string;
    speakerId?: string;
    parameters: TranslationConsumerSwitchParameters;
}
export interface ResumeOriginalProducerOptions {
    originalProducerId: string;
    speakerId?: string;
    parameters: TranslationConsumerSwitchParameters;
}
export type PauseOriginalProducerType = (options: PauseOriginalProducerOptions) => Promise<void>;
export type ResumeOriginalProducerType = (options: ResumeOriginalProducerOptions) => Promise<void>;
/**
 * Check if a speaker is in the current user's breakout room (or main room).
 * Returns true if the speaker's audio should be active (they are in our room).
 *
 * This mirrors the logic in resumePauseAudioStreams.ts to ensure parity:
 * - In webinars: host audio is always active for non-hosts
 * - In conferences: host audio depends on hostNewRoom vs current user's room
 * - Regular participants: must be in the same limitedBreakRoom
 */
export declare const isSpeakerInMyBreakoutRoom: (speakerName: string, parameters: TranslationConsumerSwitchParameters) => boolean;
/**
 * Pause the original audio producer consumer when switching to translation.
 * This saves bandwidth by not receiving audio we won't use.
 *
 * NOTE: Only pauses if the speaker is in our breakout room. If they're not,
 * their audio is already paused by the breakout room logic.
 */
export declare const pauseOriginalProducer: PauseOriginalProducerType;
/**
 * Resume the original audio producer consumer when translation stops.
 *
 * NOTE: Only resumes if the speaker is in our breakout room. If they're not,
 * their audio should stay paused (controlled by breakout room logic).
 */
export declare const resumeOriginalProducer: ResumeOriginalProducerType;
/**
 * Check if we're currently consuming a translation for a given speaker.
 * Looks for consumers that have translation metadata attached.
 */
export declare const isConsumingTranslationForSpeaker: (speakerId: string, consumerTransports: Transport[], translationProducerMap: Map<string, {
    translationProducerId: string;
    originalProducerId: string;
    language: string;
}>) => {
    consuming: boolean;
    language?: string;
    translationProducerId?: string;
    originalProducerId?: string;
};
/**
 * Get all active translation consumers from the map.
 */
export declare const getActiveTranslationConsumers: (translationProducerMap: Map<string, {
    translationProducerId: string;
    originalProducerId: string;
    language: string;
}>, consumerTransports: Transport[]) => Array<{
    speakerId: string;
    translationProducerId: string;
    originalProducerId: string;
    language: string;
}>;
/**
 * Find the original producer ID for a speaker from all audio streams.
 * This is needed when we receive a translation producer and need to pause the original.
 */
export declare const findOriginalProducerForSpeaker: (speakerId: string, allAudioStreams: Array<{
    producerId: string;
    name?: string;
    [key: string]: any;
}>) => string | null;
/**
 * Handle breakout room changes for translation audio.
 *
 * When a user moves between breakout rooms, we need to re-evaluate
 * which translation streams should be active:
 * - Resume original audio for speakers now in our room (if no translation active)
 * - The breakout room audio logic (resumePauseAudioStreams) will handle pausing
 *   speakers not in our room
 *
 * This function is called after breakout room updates to sync translation state.
 *
 * @param translationProducerMap - Map of originalProducerId → { language → translationProducerId }
 * @param parameters - Consumer switch parameters including breakout room state
 */
export interface StopConsumingTranslationOptions {
    speakerId: string;
    language: string;
    translationProducerMap: Record<string, Record<string, string>>;
    parameters: TranslationConsumerSwitchParameters;
}
export type StopConsumingTranslationType = (options: StopConsumingTranslationOptions) => Promise<string | null>;
/**
 * Stop consuming a translation producer and close its consumer.
 * Returns the original producer ID if found, so caller can resume it.
 *
 * Flow:
 * 1. Find the translation producer ID from the translation map
 * 2. Find the consumer transport for that producer
 * 3. Close the consumer (both locally and on server)
 * 4. Return the original producer ID for resuming
 */
export declare const stopConsumingTranslation: StopConsumingTranslationType;
export declare const syncTranslationStateAfterBreakoutChange: (translationProducerMap: Record<string, Record<string, string>>, speakerIdByProducerId: Record<string, string>, parameters: TranslationConsumerSwitchParameters) => Promise<void>;
//# sourceMappingURL=translationConsumerSwitch.d.ts.map