import { ConnectionEvent, EventSource, IAudioDestination, IConnection, IDisposable, ServiceEvent } from "../common/Exports.js";
import { AudioOutputFormatImpl } from "../sdk/Audio/AudioOutputFormat.js";
import { CancellationErrorCode, CancellationReason, SpeechSynthesisBookmarkEventArgs, SpeechSynthesisResult, SpeechSynthesisVisemeEventArgs, SpeechSynthesisWordBoundaryEventArgs, Synthesizer } from "../sdk/Exports.js";
import { SpeechSynthesisRequest } from "../sdk/SpeechSynthesisRequest.js";
import { AgentConfig, ISynthesisConnectionFactory, ISynthesisMetadata, SynthesisContext, SynthesisTurn, SynthesizerConfig } from "./Exports.js";
import { IAuthentication } from "./IAuthentication.js";
import { SpeechConnectionMessage } from "./SpeechConnectionMessage.Internal.js";
export declare abstract class SynthesisAdapterBase implements IDisposable {
    protected privSynthesisTurn: SynthesisTurn;
    protected privConnectionId: string;
    protected privSynthesizerConfig: SynthesizerConfig;
    protected privSynthesizer: Synthesizer;
    protected privSuccessCallback: (e: SpeechSynthesisResult) => void;
    protected privErrorCallback: (e: string) => void;
    get synthesizerConfig(): SynthesizerConfig;
    get synthesisContext(): SynthesisContext;
    get agentConfig(): AgentConfig;
    get connectionEvents(): EventSource<ConnectionEvent>;
    get serviceEvents(): EventSource<ServiceEvent>;
    protected speakOverride: (ssml: string, requestId: string, sc: (e: SpeechSynthesisResult) => void, ec: (e: string) => void) => void;
    static telemetryData: (json: string) => void;
    static telemetryDataEnabled: boolean;
    set activityTemplate(messagePayload: string);
    get activityTemplate(): string;
    protected receiveMessageOverride: () => void;
    protected connectImplOverride: (isUnAuthorized: boolean) => void;
    protected configConnectionOverride: (connection: IConnection) => Promise<IConnection>;
    set audioOutputFormat(format: AudioOutputFormatImpl);
    private privAuthentication;
    private privConnectionFactory;
    private privConnectionConfigurationPromise;
    private privConnectionPromise;
    private privAuthFetchEventId;
    private privIsDisposed;
    private privConnectionEvents;
    private privServiceEvents;
    protected privSynthesisContext: SynthesisContext;
    private privAgentConfig;
    private privActivityTemplate;
    protected privAudioOutputFormat: AudioOutputFormatImpl;
    private privSessionAudioDestination;
    constructor(authentication: IAuthentication, connectionFactory: ISynthesisConnectionFactory, synthesizerConfig: SynthesizerConfig, audioDestination: IAudioDestination);
    isDisposed(): boolean;
    dispose(reason?: string): Promise<void>;
    connect(): Promise<void>;
    sendNetworkMessage(path: string, payload: string | ArrayBuffer): Promise<void>;
    Speak(text: string, isSSML: boolean, requestId: string, successCallback: (e: SpeechSynthesisResult) => void, errorCallBack: (e: string) => void, audioDestination: IAudioDestination | undefined): Promise<void>;
    stopSpeaking(): Promise<void>;
    /**
     * Performs text streaming synthesis using a SpeechSynthesisRequest.
     * Text pieces are sent over WebSocket as they arrive via the request's input stream.
     */
    SpeakStream(request: SpeechSynthesisRequest, requestId: string, successCallback: (e: SpeechSynthesisResult) => void, errorCallBack: (e: string) => void, audioDestination: IAudioDestination | undefined): Promise<void>;
    protected cancelSynthesis(requestId: string, _cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string): void;
    protected cancelSynthesisLocal(cancellationReason: CancellationReason, errorCode: CancellationErrorCode, error: string): void;
    protected processTypeSpecificMessages(_connectionMessage: SpeechConnectionMessage): boolean;
    protected receiveMessage(): Promise<void>;
    protected sendSynthesisContext(connection: IConnection): Promise<void>;
    protected abstract setSynthesisContextSynthesisSection(): void;
    protected setSpeechConfigSynthesisSection(): void;
    protected connectImpl(isUnAuthorized?: boolean): Promise<IConnection>;
    protected sendSpeechServiceConfig(connection: IConnection, SpeechServiceConfigJson: string): Promise<void>;
    protected sendSsmlMessage(connection: IConnection, ssml: string, requestId: string): Promise<void>;
    /**
     * Sends the synthesis.context message for text streaming mode.
     * Includes the standard audio/language sections plus an input section
     * with bidirectionalStreamingMode, voice name, and per-request properties.
     */
    protected sendStreamingSynthesisContext(connection: IConnection, request: SpeechSynthesisRequest, requestId: string): Promise<void>;
    /**
     * Sends a text piece for streaming synthesis.
     * Path: text.piece, Content-Type: text/plain, Body: raw text
     */
    protected sendTextPiece(connection: IConnection, text: string, requestId: string): Promise<void>;
    /**
     * Sends the end-of-stream signal for text streaming synthesis.
     * Path: text.end, Content-Type: text/plain, Body: empty
     */
    protected sendTextStreamEnd(connection: IConnection, requestId: string): Promise<void>;
    private fetchConnection;
    private configureConnection;
    protected onAvatarEvent(_metadata: ISynthesisMetadata): void;
    protected onSynthesisStarted(_requestId: string): void;
    protected onSynthesizing(_audio: ArrayBuffer): void;
    protected onSynthesisCancelled(_result: SpeechSynthesisResult): void;
    protected onSynthesisCompleted(_result: SpeechSynthesisResult): void;
    protected onWordBoundary(_wordBoundaryEventArgs: SpeechSynthesisWordBoundaryEventArgs): void;
    protected onVisemeReceived(_visemeEventArgs: SpeechSynthesisVisemeEventArgs): void;
    protected onBookmarkReached(_bookmarkEventArgs: SpeechSynthesisBookmarkEventArgs): void;
}
