import { ICallback } from '@onereach/flow-sdk/dst/types/eventManager';
import { IPromtpSection, IVoiceReporterTranscriptEventArgs } from '@onereach/flow-sdk/dst/types/reporter';
import { IEvent } from '@onereach/flow-sdk/dst/types/event';
import ConvStep, { IConversationData } from './step';
import BasicError from '@onereach/flow-sdk/dst/errors/base';
import { WITH_VAR } from "@onereach/flow-sdk/types/thread";
export type TODO = any;
export interface SensitiveData {
    muteStep: boolean;
    muteUser: boolean;
    muteBot: boolean;
}
export interface IVoiceCall extends IConversationData {
    /** voicer protocol version */
    vv: number;
    id: string;
    ended: boolean;
    endUserNumber: string;
    botNumber: string;
    lastTranscriptId: string;
    type: string;
    callback: ICallback;
    global?: TODO;
    recordCall: boolean;
    asr?: TODO;
    tts?: TODO;
    sessionEndedBy?: string;
    to?: string;
    from?: string;
    headers?: Record<string, string>;
    conference?: {
        room: string;
        user: string;
    };
}
export type EventType = 'hangup' | 'ack' | 'error' | 'cancel' | 'background' | 'avm-detected' | 'recognition' | 'digit' | 'digits' | 'conference-start' | 'conference-end' | 'playback' | 'timeout' | 'record' | 'bridge' | 'bridge/ended' | 'is_flow_ready' | 'call' | 'dtmf-sent';
export declare class VoiceStepError extends BasicError {
}
export type VoicerError = Error & {
    originateStatus?: string;
    date?: string;
} | string & {
    message?: never;
    name?: never;
    date?: never;
    originateStatus?: never;
};
export interface VoiceInterruptionMetadata {
    interruptionReason: 'keypad' | 'voice';
    interruptionTime: number;
    playedTime: number;
    sectionIndex: number;
    sectionDuration: number;
    reporterTranscriptEventId: string;
}
export interface VoiceEvent {
    type: EventType;
    global?: boolean;
    error?: VoicerError;
    interruptionMetadata?: VoiceInterruptionMetadata;
    result?: {
        interruptionMetadata?: VoiceInterruptionMetadata;
    };
}
export interface CallStartEvent extends VoiceEvent {
    channel: IVoiceCall;
    headers?: Record<string, string>;
}
export interface HandleInterruptionParams<TParams extends VoiceEvent = VoiceEvent> {
    call: IVoiceCall;
    event: IEvent<TParams>;
    speechSections: IPromtpSection[];
    repromptsList?: {
        message?: string;
        fileName?: string;
    }[];
    reportingSettingsKey?: string;
}
export type VoiceEvents<TParams> = IEvent<TParams, WITH_VAR<'in/voice/'>> | IEvent<TParams, WITH_VAR<'in/voice/', '/event'>>;
export default class VoiceStep<TIn = unknown, TOut = unknown, TParams extends VoiceEvent = VoiceEvent> extends ConvStep<IVoiceCall, TIn & {
    handleCancel?: boolean;
}, TOut, VoiceEvents<TParams>> {
    runBefore(): Promise<void>;
    exitStep(exitId: string, data?: any, byThread?: boolean): any;
    exitStepByThread(exitId: string, result: any): any;
    exitToThread(): void;
    sendCommands({ id, type, callback }: IVoiceCall, commands: TODO[]): Promise<void>;
    handleHeartbeat(call: IVoiceCall): Promise<void>;
    handleCancel(): void;
    extractSectionMessages(sections: IPromtpSection[], interruptionMetadata?: VoiceInterruptionMetadata): string;
    extractPlayedSectionMessage(text: string, sectionDuration: number, playedTime: number): string;
    extractSectionFiles(sections: IPromtpSection[]): Array<{
        fileUrl: string;
        fileType: string;
    }>;
    pauseRecording(call: IVoiceCall, command: any, sensitiveData?: SensitiveData): Promise<void>;
    resumeRecording(call: IVoiceCall, sensitiveData?: SensitiveData): Promise<void>;
    transcript(call: IVoiceCall, data?: Partial<IVoiceReporterTranscriptEventArgs>, interruptionMetadata?: VoiceInterruptionMetadata): Promise<string>;
    throwError(error?: VoicerError): never;
    handleHangup(call: IVoiceCall): Promise<void>;
    buildSections({ sections, textType, ttsSettings, allowKeypadBargeIn }: TODO): TODO;
    buildReprompts({ prompts, allowKeypadBargeIn }: TODO): TODO;
    buildChoices({ choices }: TODO): TODO;
    buildChoice(choice: TODO): TODO;
    exitChoiceData(type: string, params?: TODO): TODO;
    rptsSend(call: IVoiceCall, { command, reporting, repromptsList, noReplyDelay, speechSections, textType, ttsSettings, sensitiveData }: TODO): Promise<void>;
    rptsTimeout({ noReplyDelay, repromptsList, initial }: TODO): number;
    rptsRestart(): void;
    rptsHasMore({ repromptsList }: TODO): boolean;
    get rptsIndex(): number;
    get rptsStarted(): boolean;
    canVoicerHearbeat(call: IVoiceCall): boolean;
    canVoicerAck(call: IVoiceCall): boolean;
    getInterruptionMetadata(event: IEvent<TParams>): VoiceInterruptionMetadata | null;
    handleInterruption(params: HandleInterruptionParams<TParams>): Promise<void>;
}
