import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { type CallOptions, ChannelCredentials, Client, ClientDuplexStream, type ClientOptions, ClientReadableStream, type ClientUnaryCall, handleBidiStreamingCall, handleServerStreamingCall, type handleUnaryCall, Metadata, type ServiceError, type UntypedServiceImplementation } from "@grpc/grpc-js";
import { SpeechLocale, SpeechRequestOption, Voice } from "./TTSTypes.js";
export declare const protobufPackage = "aristech.tts";
/** Commands that can be used in ServerCommand */
export declare enum CommandType {
    START_REQUEST = 0,
    STOP_REQUEST = 1,
    STATUS_REQUEST = 2,
    UNRECOGNIZED = -1
}
export declare function commandTypeFromJSON(object: any): CommandType;
export declare function commandTypeToJSON(object: CommandType): string;
export declare enum CommandResponseType {
    /** STARTRESPONSE - Synthesis startet */
    STARTRESPONSE = 0,
    /** STOPRESPONSE - Synthesis stopped */
    STOPRESPONSE = 1,
    /** STATUSRESPONSE - Response contains status information */
    STATUSRESPONSE = 2,
    /** SYNTHESISRESPONSE - Response contains SpeechResponses */
    SYNTHESISRESPONSE = 3,
    UNRECOGNIZED = -1
}
export declare function commandResponseTypeFromJSON(object: any): CommandResponseType;
export declare function commandResponseTypeToJSON(object: CommandResponseType): string;
/**
 * `SpeechRequest` is the top-level message sent by the client for
 * the `getSpeech` method.
 */
export interface SpeechRequest {
    /** Required: The text that will be transformed into audio. */
    text: string;
    /** Required: Further options for the request. */
    options: SpeechRequestOption | undefined;
    /** Currently not used */
    parameters: string;
    /** Use "SSML" */
    inputType: string;
    /** Use "AUDIO" */
    outputType: string;
}
export interface PhonesetRequest {
    /**
     * Required: The voice of which the phoneset is requested. Only `Voice.name`
     * has to be filled
     */
    voice: Voice | undefined;
}
export interface PhonesetResponse {
    status: number;
    message: string;
    /** A json array that contains a representation of the phoneset */
    phoneset: string;
}
export interface TranscriptionRequest {
    /**
     * Required: The voice of which the phoneset is requested. Only `Voice.name`
     * has to be filled
     */
    voice: Voice | undefined;
    /** Required: The word to be transcribed */
    word: string;
}
export interface TranscriptionResponse {
    status: number;
    message: string;
    /** The transcription of the submitted word */
    transcription: string;
}
/**
 * A command that is sent to the speech engine. START_REQUEST has to encapsulate
 * a SpeechRequest.
 */
export interface ServerCommand {
    commandType: CommandType;
    commandData: Uint8Array;
    speechRequest: SpeechRequest | undefined;
}
/** The server's response to a ServerCommand. */
export interface ServerCommandResponse {
    responseType: CommandResponseType;
    status: number;
    message: string;
    responseData: Uint8Array;
    speechResponse: SpeechResponse[];
}
/**
 * `SpeechResponse` is the top-level message sent by the server for
 * the `getSpeech` and `ProcessData`methods. Possibly multiple `SpeechResponse`
 * messages are sent while the audio is being generated.
 * When the requested output_type is a text type, there will be only one
 * SpeechResponse that contains the whole block.
 * Howevery, output_type AUDIO will return multiple blocks of audio signal
 * that have to be concatenated or streamed to an audio device
 */
export interface SpeechResponse {
    /**
     * The audio data bytes encoded as specified in
     * `SpeechRequestOptionAudioFormat`.
     */
    status: number;
    data: Uint8Array;
    inputType: string;
    outputType: string;
}
/**
 * Requests a VoiceListResponse that contains all available voices (with the
 * specified locale)
 */
export interface VoiceListRequest {
    locale: SpeechLocale | undefined;
}
export declare const SpeechRequest: MessageFns<SpeechRequest>;
export declare const PhonesetRequest: MessageFns<PhonesetRequest>;
export declare const PhonesetResponse: MessageFns<PhonesetResponse>;
export declare const TranscriptionRequest: MessageFns<TranscriptionRequest>;
export declare const TranscriptionResponse: MessageFns<TranscriptionResponse>;
export declare const ServerCommand: MessageFns<ServerCommand>;
export declare const ServerCommandResponse: MessageFns<ServerCommandResponse>;
export declare const SpeechResponse: MessageFns<SpeechResponse>;
export declare const VoiceListRequest: MessageFns<VoiceListRequest>;
/** Service that implements Aristech Speech-API (TTS-API, ariTTS) */
export type SpeechServiceService = typeof SpeechServiceService;
export declare const SpeechServiceService: {
    /**
     * Performs Text-to-Speech with the given SpeechRequest and streams back the
     * audio as packets of type SpeechResponse.
     */
    readonly getSpeech: {
        readonly path: "/aristech.tts.SpeechService/GetSpeech";
        readonly requestStream: false;
        readonly responseStream: true;
        readonly requestSerialize: (value: SpeechRequest) => Buffer<ArrayBuffer>;
        readonly requestDeserialize: (value: Buffer) => SpeechRequest;
        readonly responseSerialize: (value: SpeechResponse) => Buffer<ArrayBuffer>;
        readonly responseDeserialize: (value: Buffer) => SpeechResponse;
    };
    /**
     * Performs Text-to-Speech and streams back the audio. Adds the capability to
     * stop the speech synthesis and free a port during synthesis.
     */
    readonly controlServer: {
        readonly path: "/aristech.tts.SpeechService/ControlServer";
        readonly requestStream: true;
        readonly responseStream: true;
        readonly requestSerialize: (value: ServerCommand) => Buffer<ArrayBuffer>;
        readonly requestDeserialize: (value: Buffer) => ServerCommand;
        readonly responseSerialize: (value: ServerCommandResponse) => Buffer<ArrayBuffer>;
        readonly responseDeserialize: (value: Buffer) => ServerCommandResponse;
    };
    /** Returns available voices as stream. */
    readonly getVoiceList: {
        readonly path: "/aristech.tts.SpeechService/GetVoiceList";
        readonly requestStream: false;
        readonly responseStream: true;
        readonly requestSerialize: (value: VoiceListRequest) => Buffer<ArrayBuffer>;
        readonly requestDeserialize: (value: Buffer) => VoiceListRequest;
        readonly responseSerialize: (value: Voice) => Buffer<ArrayBuffer>;
        readonly responseDeserialize: (value: Buffer) => Voice;
    };
    /** Returns the phoneset for a given voice */
    readonly getPhoneset: {
        readonly path: "/aristech.tts.SpeechService/GetPhoneset";
        readonly requestStream: false;
        readonly responseStream: false;
        readonly requestSerialize: (value: PhonesetRequest) => Buffer<ArrayBuffer>;
        readonly requestDeserialize: (value: Buffer) => PhonesetRequest;
        readonly responseSerialize: (value: PhonesetResponse) => Buffer<ArrayBuffer>;
        readonly responseDeserialize: (value: Buffer) => PhonesetResponse;
    };
    /** Returns the transcription for a word for a given voice */
    readonly getTranscription: {
        readonly path: "/aristech.tts.SpeechService/GetTranscription";
        readonly requestStream: false;
        readonly responseStream: false;
        readonly requestSerialize: (value: TranscriptionRequest) => Buffer<ArrayBuffer>;
        readonly requestDeserialize: (value: Buffer) => TranscriptionRequest;
        readonly responseSerialize: (value: TranscriptionResponse) => Buffer<ArrayBuffer>;
        readonly responseDeserialize: (value: Buffer) => TranscriptionResponse;
    };
};
export interface SpeechServiceServer extends UntypedServiceImplementation {
    /**
     * Performs Text-to-Speech with the given SpeechRequest and streams back the
     * audio as packets of type SpeechResponse.
     */
    getSpeech: handleServerStreamingCall<SpeechRequest, SpeechResponse>;
    /**
     * Performs Text-to-Speech and streams back the audio. Adds the capability to
     * stop the speech synthesis and free a port during synthesis.
     */
    controlServer: handleBidiStreamingCall<ServerCommand, ServerCommandResponse>;
    /** Returns available voices as stream. */
    getVoiceList: handleServerStreamingCall<VoiceListRequest, Voice>;
    /** Returns the phoneset for a given voice */
    getPhoneset: handleUnaryCall<PhonesetRequest, PhonesetResponse>;
    /** Returns the transcription for a word for a given voice */
    getTranscription: handleUnaryCall<TranscriptionRequest, TranscriptionResponse>;
}
export interface SpeechServiceClient extends Client {
    /**
     * Performs Text-to-Speech with the given SpeechRequest and streams back the
     * audio as packets of type SpeechResponse.
     */
    getSpeech(request: SpeechRequest, options?: Partial<CallOptions>): ClientReadableStream<SpeechResponse>;
    getSpeech(request: SpeechRequest, metadata?: Metadata, options?: Partial<CallOptions>): ClientReadableStream<SpeechResponse>;
    /**
     * Performs Text-to-Speech and streams back the audio. Adds the capability to
     * stop the speech synthesis and free a port during synthesis.
     */
    controlServer(): ClientDuplexStream<ServerCommand, ServerCommandResponse>;
    controlServer(options: Partial<CallOptions>): ClientDuplexStream<ServerCommand, ServerCommandResponse>;
    controlServer(metadata: Metadata, options?: Partial<CallOptions>): ClientDuplexStream<ServerCommand, ServerCommandResponse>;
    /** Returns available voices as stream. */
    getVoiceList(request: VoiceListRequest, options?: Partial<CallOptions>): ClientReadableStream<Voice>;
    getVoiceList(request: VoiceListRequest, metadata?: Metadata, options?: Partial<CallOptions>): ClientReadableStream<Voice>;
    /** Returns the phoneset for a given voice */
    getPhoneset(request: PhonesetRequest, callback: (error: ServiceError | null, response: PhonesetResponse) => void): ClientUnaryCall;
    getPhoneset(request: PhonesetRequest, metadata: Metadata, callback: (error: ServiceError | null, response: PhonesetResponse) => void): ClientUnaryCall;
    getPhoneset(request: PhonesetRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: PhonesetResponse) => void): ClientUnaryCall;
    /** Returns the transcription for a word for a given voice */
    getTranscription(request: TranscriptionRequest, callback: (error: ServiceError | null, response: TranscriptionResponse) => void): ClientUnaryCall;
    getTranscription(request: TranscriptionRequest, metadata: Metadata, callback: (error: ServiceError | null, response: TranscriptionResponse) => void): ClientUnaryCall;
    getTranscription(request: TranscriptionRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: TranscriptionResponse) => void): ClientUnaryCall;
}
export declare const SpeechServiceClient: {
    new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): SpeechServiceClient;
    service: typeof SpeechServiceService;
    serviceName: string;
};
/** Internal Use Only: debug access to engine */
export type DebugServiceService = typeof DebugServiceService;
export declare const DebugServiceService: {
    readonly processData: {
        readonly path: "/aristech.tts.DebugService/ProcessData";
        readonly requestStream: false;
        readonly responseStream: true;
        readonly requestSerialize: (value: SpeechRequest) => Buffer<ArrayBuffer>;
        readonly requestDeserialize: (value: Buffer) => SpeechRequest;
        readonly responseSerialize: (value: SpeechResponse) => Buffer<ArrayBuffer>;
        readonly responseDeserialize: (value: Buffer) => SpeechResponse;
    };
};
export interface DebugServiceServer extends UntypedServiceImplementation {
    processData: handleServerStreamingCall<SpeechRequest, SpeechResponse>;
}
export interface DebugServiceClient extends Client {
    processData(request: SpeechRequest, options?: Partial<CallOptions>): ClientReadableStream<SpeechResponse>;
    processData(request: SpeechRequest, metadata?: Metadata, options?: Partial<CallOptions>): ClientReadableStream<SpeechResponse>;
}
export declare const DebugServiceClient: {
    new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): DebugServiceClient;
    service: typeof DebugServiceService;
    serviceName: string;
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
    [K in keyof T]?: DeepPartial<T[K]>;
} : Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
    [K in keyof P]: Exact<P[K], I[K]>;
} & {
    [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
};
export interface MessageFns<T> {
    encode(message: T, writer?: BinaryWriter): BinaryWriter;
    decode(input: BinaryReader | Uint8Array, length?: number): T;
    fromJSON(object: any): T;
    toJSON(message: T): unknown;
    create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
    fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
}
export {};
