import { WireType } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { Ack } from "./common.js";
import { Struct } from "../../google/protobuf/struct.js";
import { Timestamp } from "../../google/protobuf/timestamp.js";
/**
 * @generated from protobuf enum nimi.runtime.v1.VoiceWorkflowType
 */
export var VoiceWorkflowType;
(function (VoiceWorkflowType) {
    /**
     * @generated from protobuf enum value: VOICE_WORKFLOW_TYPE_UNSPECIFIED = 0;
     */
    VoiceWorkflowType[VoiceWorkflowType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: VOICE_WORKFLOW_TYPE_VOICE_CLONE = 1;
     */
    VoiceWorkflowType[VoiceWorkflowType["VOICE_CLONE"] = 1] = "VOICE_CLONE";
    /**
     * @generated from protobuf enum value: VOICE_WORKFLOW_TYPE_VOICE_DESIGN = 2;
     */
    VoiceWorkflowType[VoiceWorkflowType["VOICE_DESIGN"] = 2] = "VOICE_DESIGN";
})(VoiceWorkflowType || (VoiceWorkflowType = {}));
/**
 * @generated from protobuf enum nimi.runtime.v1.VoiceReferenceKind
 */
export var VoiceReferenceKind;
(function (VoiceReferenceKind) {
    /**
     * @generated from protobuf enum value: VOICE_REFERENCE_KIND_UNSPECIFIED = 0;
     */
    VoiceReferenceKind[VoiceReferenceKind["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: VOICE_REFERENCE_KIND_PRESET = 1;
     */
    VoiceReferenceKind[VoiceReferenceKind["PRESET"] = 1] = "PRESET";
    /**
     * @generated from protobuf enum value: VOICE_REFERENCE_KIND_VOICE_ASSET = 2;
     */
    VoiceReferenceKind[VoiceReferenceKind["VOICE_ASSET"] = 2] = "VOICE_ASSET";
    /**
     * @generated from protobuf enum value: VOICE_REFERENCE_KIND_PROVIDER_VOICE_REF = 3;
     */
    VoiceReferenceKind[VoiceReferenceKind["PROVIDER_VOICE_REF"] = 3] = "PROVIDER_VOICE_REF";
})(VoiceReferenceKind || (VoiceReferenceKind = {}));
/**
 * @generated from protobuf enum nimi.runtime.v1.VoiceAssetPersistence
 */
export var VoiceAssetPersistence;
(function (VoiceAssetPersistence) {
    /**
     * @generated from protobuf enum value: VOICE_ASSET_PERSISTENCE_UNSPECIFIED = 0;
     */
    VoiceAssetPersistence[VoiceAssetPersistence["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: VOICE_ASSET_PERSISTENCE_PROVIDER_PERSISTENT = 1;
     */
    VoiceAssetPersistence[VoiceAssetPersistence["PROVIDER_PERSISTENT"] = 1] = "PROVIDER_PERSISTENT";
    /**
     * @generated from protobuf enum value: VOICE_ASSET_PERSISTENCE_SESSION_EPHEMERAL = 2;
     */
    VoiceAssetPersistence[VoiceAssetPersistence["SESSION_EPHEMERAL"] = 2] = "SESSION_EPHEMERAL";
})(VoiceAssetPersistence || (VoiceAssetPersistence = {}));
/**
 * @generated from protobuf enum nimi.runtime.v1.VoiceAssetStatus
 */
export var VoiceAssetStatus;
(function (VoiceAssetStatus) {
    /**
     * @generated from protobuf enum value: VOICE_ASSET_STATUS_UNSPECIFIED = 0;
     */
    VoiceAssetStatus[VoiceAssetStatus["UNSPECIFIED"] = 0] = "UNSPECIFIED";
    /**
     * @generated from protobuf enum value: VOICE_ASSET_STATUS_ACTIVE = 1;
     */
    VoiceAssetStatus[VoiceAssetStatus["ACTIVE"] = 1] = "ACTIVE";
    /**
     * @generated from protobuf enum value: VOICE_ASSET_STATUS_EXPIRED = 2;
     */
    VoiceAssetStatus[VoiceAssetStatus["EXPIRED"] = 2] = "EXPIRED";
    /**
     * @generated from protobuf enum value: VOICE_ASSET_STATUS_DELETED = 3;
     */
    VoiceAssetStatus[VoiceAssetStatus["DELETED"] = 3] = "DELETED";
    /**
     * @generated from protobuf enum value: VOICE_ASSET_STATUS_FAILED = 4;
     */
    VoiceAssetStatus[VoiceAssetStatus["FAILED"] = 4] = "FAILED";
})(VoiceAssetStatus || (VoiceAssetStatus = {}));
// @generated message type with reflection information, may provide speed optimized methods
class VoiceReference$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.VoiceReference", [
            { no: 1, name: "kind", kind: "enum", T: () => ["nimi.runtime.v1.VoiceReferenceKind", VoiceReferenceKind, "VOICE_REFERENCE_KIND_"] },
            { no: 2, name: "preset_voice_id", kind: "scalar", oneof: "reference", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "voice_asset_id", kind: "scalar", oneof: "reference", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "provider_voice_ref", kind: "scalar", oneof: "reference", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.kind = 0;
        message.reference = { oneofKind: undefined };
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.VoiceReferenceKind kind */ 1:
                    message.kind = reader.int32();
                    break;
                case /* string preset_voice_id */ 2:
                    message.reference = {
                        oneofKind: "presetVoiceId",
                        presetVoiceId: reader.string()
                    };
                    break;
                case /* string voice_asset_id */ 3:
                    message.reference = {
                        oneofKind: "voiceAssetId",
                        voiceAssetId: reader.string()
                    };
                    break;
                case /* string provider_voice_ref */ 4:
                    message.reference = {
                        oneofKind: "providerVoiceRef",
                        providerVoiceRef: reader.string()
                    };
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* nimi.runtime.v1.VoiceReferenceKind kind = 1; */
        if (message.kind !== 0)
            writer.tag(1, WireType.Varint).int32(message.kind);
        /* string preset_voice_id = 2; */
        if (message.reference.oneofKind === "presetVoiceId")
            writer.tag(2, WireType.LengthDelimited).string(message.reference.presetVoiceId);
        /* string voice_asset_id = 3; */
        if (message.reference.oneofKind === "voiceAssetId")
            writer.tag(3, WireType.LengthDelimited).string(message.reference.voiceAssetId);
        /* string provider_voice_ref = 4; */
        if (message.reference.oneofKind === "providerVoiceRef")
            writer.tag(4, WireType.LengthDelimited).string(message.reference.providerVoiceRef);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.VoiceReference
 */
export const VoiceReference = new VoiceReference$Type();
// @generated message type with reflection information, may provide speed optimized methods
class VoicePresetDescriptor$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.VoicePresetDescriptor", [
            { no: 1, name: "voice_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "lang", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "supported_langs", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "labels", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
            { no: 6, name: "category", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "preview_audio_uri", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.voiceId = "";
        message.name = "";
        message.lang = "";
        message.supportedLangs = [];
        message.labels = {};
        message.category = "";
        message.previewAudioUri = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string voice_id */ 1:
                    message.voiceId = reader.string();
                    break;
                case /* string name */ 2:
                    message.name = reader.string();
                    break;
                case /* string lang */ 3:
                    message.lang = reader.string();
                    break;
                case /* repeated string supported_langs */ 4:
                    message.supportedLangs.push(reader.string());
                    break;
                case /* map<string, string> labels */ 5:
                    this.binaryReadMap5(message.labels, reader, options);
                    break;
                case /* string category */ 6:
                    message.category = reader.string();
                    break;
                case /* string preview_audio_uri */ 7:
                    message.previewAudioUri = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    binaryReadMap5(map, reader, options) {
        let len = reader.uint32(), end = reader.pos + len, key, val;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case 1:
                    key = reader.string();
                    break;
                case 2:
                    val = reader.string();
                    break;
                default: throw new globalThis.Error("unknown map entry field for nimi.runtime.v1.VoicePresetDescriptor.labels");
            }
        }
        map[key ?? ""] = val ?? "";
    }
    internalBinaryWrite(message, writer, options) {
        /* string voice_id = 1; */
        if (message.voiceId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.voiceId);
        /* string name = 2; */
        if (message.name !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.name);
        /* string lang = 3; */
        if (message.lang !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.lang);
        /* repeated string supported_langs = 4; */
        for (let i = 0; i < message.supportedLangs.length; i++)
            writer.tag(4, WireType.LengthDelimited).string(message.supportedLangs[i]);
        /* map<string, string> labels = 5; */
        for (let k of globalThis.Object.keys(message.labels))
            writer.tag(5, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.labels[k]).join();
        /* string category = 6; */
        if (message.category !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.category);
        /* string preview_audio_uri = 7; */
        if (message.previewAudioUri !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.previewAudioUri);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.VoicePresetDescriptor
 */
export const VoicePresetDescriptor = new VoicePresetDescriptor$Type();
// @generated message type with reflection information, may provide speed optimized methods
class VoiceAsset$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.VoiceAsset", [
            { no: 1, name: "voice_asset_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "workflow_type", kind: "enum", T: () => ["nimi.runtime.v1.VoiceWorkflowType", VoiceWorkflowType, "VOICE_WORKFLOW_TYPE_"] },
            { no: 5, name: "provider", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "model_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 7, name: "target_model_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 8, name: "provider_voice_ref", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "persistence", kind: "enum", T: () => ["nimi.runtime.v1.VoiceAssetPersistence", VoiceAssetPersistence, "VOICE_ASSET_PERSISTENCE_"] },
            { no: 10, name: "status", kind: "enum", T: () => ["nimi.runtime.v1.VoiceAssetStatus", VoiceAssetStatus, "VOICE_ASSET_STATUS_"] },
            { no: 11, name: "created_at", kind: "message", T: () => Timestamp },
            { no: 12, name: "updated_at", kind: "message", T: () => Timestamp },
            { no: 13, name: "expires_at", kind: "message", T: () => Timestamp },
            { no: 14, name: "metadata", kind: "message", T: () => Struct }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.voiceAssetId = "";
        message.appId = "";
        message.subjectUserId = "";
        message.workflowType = 0;
        message.provider = "";
        message.modelId = "";
        message.targetModelId = "";
        message.providerVoiceRef = "";
        message.persistence = 0;
        message.status = 0;
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string voice_asset_id */ 1:
                    message.voiceAssetId = reader.string();
                    break;
                case /* string app_id */ 2:
                    message.appId = reader.string();
                    break;
                case /* string subject_user_id */ 3:
                    message.subjectUserId = reader.string();
                    break;
                case /* nimi.runtime.v1.VoiceWorkflowType workflow_type */ 4:
                    message.workflowType = reader.int32();
                    break;
                case /* string provider */ 5:
                    message.provider = reader.string();
                    break;
                case /* string model_id */ 6:
                    message.modelId = reader.string();
                    break;
                case /* string target_model_id */ 7:
                    message.targetModelId = reader.string();
                    break;
                case /* string provider_voice_ref */ 8:
                    message.providerVoiceRef = reader.string();
                    break;
                case /* nimi.runtime.v1.VoiceAssetPersistence persistence */ 9:
                    message.persistence = reader.int32();
                    break;
                case /* nimi.runtime.v1.VoiceAssetStatus status */ 10:
                    message.status = reader.int32();
                    break;
                case /* google.protobuf.Timestamp created_at */ 11:
                    message.createdAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createdAt);
                    break;
                case /* google.protobuf.Timestamp updated_at */ 12:
                    message.updatedAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.updatedAt);
                    break;
                case /* google.protobuf.Timestamp expires_at */ 13:
                    message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
                    break;
                case /* google.protobuf.Struct metadata */ 14:
                    message.metadata = Struct.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string voice_asset_id = 1; */
        if (message.voiceAssetId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.voiceAssetId);
        /* string app_id = 2; */
        if (message.appId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.appId);
        /* string subject_user_id = 3; */
        if (message.subjectUserId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.subjectUserId);
        /* nimi.runtime.v1.VoiceWorkflowType workflow_type = 4; */
        if (message.workflowType !== 0)
            writer.tag(4, WireType.Varint).int32(message.workflowType);
        /* string provider = 5; */
        if (message.provider !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.provider);
        /* string model_id = 6; */
        if (message.modelId !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.modelId);
        /* string target_model_id = 7; */
        if (message.targetModelId !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.targetModelId);
        /* string provider_voice_ref = 8; */
        if (message.providerVoiceRef !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.providerVoiceRef);
        /* nimi.runtime.v1.VoiceAssetPersistence persistence = 9; */
        if (message.persistence !== 0)
            writer.tag(9, WireType.Varint).int32(message.persistence);
        /* nimi.runtime.v1.VoiceAssetStatus status = 10; */
        if (message.status !== 0)
            writer.tag(10, WireType.Varint).int32(message.status);
        /* google.protobuf.Timestamp created_at = 11; */
        if (message.createdAt)
            Timestamp.internalBinaryWrite(message.createdAt, writer.tag(11, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Timestamp updated_at = 12; */
        if (message.updatedAt)
            Timestamp.internalBinaryWrite(message.updatedAt, writer.tag(12, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Timestamp expires_at = 13; */
        if (message.expiresAt)
            Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(13, WireType.LengthDelimited).fork(), options).join();
        /* google.protobuf.Struct metadata = 14; */
        if (message.metadata)
            Struct.internalBinaryWrite(message.metadata, writer.tag(14, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.VoiceAsset
 */
export const VoiceAsset = new VoiceAsset$Type();
// @generated message type with reflection information, may provide speed optimized methods
class VoiceV2VInput$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.VoiceV2VInput", [
            { no: 1, name: "reference_audio_bytes", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
            { no: 2, name: "reference_audio_uri", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "reference_audio_mime", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "language_hints", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "preferred_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 6, name: "text", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.referenceAudioBytes = new Uint8Array(0);
        message.referenceAudioUri = "";
        message.referenceAudioMime = "";
        message.languageHints = [];
        message.preferredName = "";
        message.text = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* bytes reference_audio_bytes */ 1:
                    message.referenceAudioBytes = reader.bytes();
                    break;
                case /* string reference_audio_uri */ 2:
                    message.referenceAudioUri = reader.string();
                    break;
                case /* string reference_audio_mime */ 3:
                    message.referenceAudioMime = reader.string();
                    break;
                case /* repeated string language_hints */ 4:
                    message.languageHints.push(reader.string());
                    break;
                case /* string preferred_name */ 5:
                    message.preferredName = reader.string();
                    break;
                case /* string text */ 6:
                    message.text = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* bytes reference_audio_bytes = 1; */
        if (message.referenceAudioBytes.length)
            writer.tag(1, WireType.LengthDelimited).bytes(message.referenceAudioBytes);
        /* string reference_audio_uri = 2; */
        if (message.referenceAudioUri !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.referenceAudioUri);
        /* string reference_audio_mime = 3; */
        if (message.referenceAudioMime !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.referenceAudioMime);
        /* repeated string language_hints = 4; */
        for (let i = 0; i < message.languageHints.length; i++)
            writer.tag(4, WireType.LengthDelimited).string(message.languageHints[i]);
        /* string preferred_name = 5; */
        if (message.preferredName !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.preferredName);
        /* string text = 6; */
        if (message.text !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.text);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.VoiceV2VInput
 */
export const VoiceV2VInput = new VoiceV2VInput$Type();
// @generated message type with reflection information, may provide speed optimized methods
class VoiceT2VInput$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.VoiceT2VInput", [
            { no: 1, name: "instruction_text", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "preview_text", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "language", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "preferred_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.instructionText = "";
        message.previewText = "";
        message.language = "";
        message.preferredName = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string instruction_text */ 1:
                    message.instructionText = reader.string();
                    break;
                case /* string preview_text */ 2:
                    message.previewText = reader.string();
                    break;
                case /* string language */ 3:
                    message.language = reader.string();
                    break;
                case /* string preferred_name */ 4:
                    message.preferredName = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string instruction_text = 1; */
        if (message.instructionText !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.instructionText);
        /* string preview_text = 2; */
        if (message.previewText !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.previewText);
        /* string language = 3; */
        if (message.language !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.language);
        /* string preferred_name = 4; */
        if (message.preferredName !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.preferredName);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.VoiceT2VInput
 */
export const VoiceT2VInput = new VoiceT2VInput$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetVoiceAssetRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.GetVoiceAssetRequest", [
            { no: 1, name: "voice_asset_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.voiceAssetId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string voice_asset_id */ 1:
                    message.voiceAssetId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string voice_asset_id = 1; */
        if (message.voiceAssetId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.voiceAssetId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.GetVoiceAssetRequest
 */
export const GetVoiceAssetRequest = new GetVoiceAssetRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class GetVoiceAssetResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.GetVoiceAssetResponse", [
            { no: 1, name: "asset", kind: "message", T: () => VoiceAsset }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.VoiceAsset asset */ 1:
                    message.asset = VoiceAsset.internalBinaryRead(reader, reader.uint32(), options, message.asset);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* nimi.runtime.v1.VoiceAsset asset = 1; */
        if (message.asset)
            VoiceAsset.internalBinaryWrite(message.asset, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.GetVoiceAssetResponse
 */
export const GetVoiceAssetResponse = new GetVoiceAssetResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListVoiceAssetsRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.ListVoiceAssetsRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "model_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "target_model_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "workflow_type", kind: "enum", T: () => ["nimi.runtime.v1.VoiceWorkflowType", VoiceWorkflowType, "VOICE_WORKFLOW_TYPE_"] },
            { no: 6, name: "status", kind: "enum", T: () => ["nimi.runtime.v1.VoiceAssetStatus", VoiceAssetStatus, "VOICE_ASSET_STATUS_"] },
            { no: 7, name: "page_size", kind: "scalar", T: 5 /*ScalarType.INT32*/ },
            { no: 8, name: "page_token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 9, name: "connector_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.subjectUserId = "";
        message.modelId = "";
        message.targetModelId = "";
        message.workflowType = 0;
        message.status = 0;
        message.pageSize = 0;
        message.pageToken = "";
        message.connectorId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string subject_user_id */ 2:
                    message.subjectUserId = reader.string();
                    break;
                case /* string model_id */ 3:
                    message.modelId = reader.string();
                    break;
                case /* string target_model_id */ 4:
                    message.targetModelId = reader.string();
                    break;
                case /* nimi.runtime.v1.VoiceWorkflowType workflow_type */ 5:
                    message.workflowType = reader.int32();
                    break;
                case /* nimi.runtime.v1.VoiceAssetStatus status */ 6:
                    message.status = reader.int32();
                    break;
                case /* int32 page_size */ 7:
                    message.pageSize = reader.int32();
                    break;
                case /* string page_token */ 8:
                    message.pageToken = reader.string();
                    break;
                case /* string connector_id */ 9:
                    message.connectorId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string subject_user_id = 2; */
        if (message.subjectUserId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.subjectUserId);
        /* string model_id = 3; */
        if (message.modelId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.modelId);
        /* string target_model_id = 4; */
        if (message.targetModelId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.targetModelId);
        /* nimi.runtime.v1.VoiceWorkflowType workflow_type = 5; */
        if (message.workflowType !== 0)
            writer.tag(5, WireType.Varint).int32(message.workflowType);
        /* nimi.runtime.v1.VoiceAssetStatus status = 6; */
        if (message.status !== 0)
            writer.tag(6, WireType.Varint).int32(message.status);
        /* int32 page_size = 7; */
        if (message.pageSize !== 0)
            writer.tag(7, WireType.Varint).int32(message.pageSize);
        /* string page_token = 8; */
        if (message.pageToken !== "")
            writer.tag(8, WireType.LengthDelimited).string(message.pageToken);
        /* string connector_id = 9; */
        if (message.connectorId !== "")
            writer.tag(9, WireType.LengthDelimited).string(message.connectorId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.ListVoiceAssetsRequest
 */
export const ListVoiceAssetsRequest = new ListVoiceAssetsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListVoiceAssetsResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.ListVoiceAssetsResponse", [
            { no: 1, name: "assets", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => VoiceAsset },
            { no: 2, name: "next_page_token", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.assets = [];
        message.nextPageToken = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated nimi.runtime.v1.VoiceAsset assets */ 1:
                    message.assets.push(VoiceAsset.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* string next_page_token */ 2:
                    message.nextPageToken = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* repeated nimi.runtime.v1.VoiceAsset assets = 1; */
        for (let i = 0; i < message.assets.length; i++)
            VoiceAsset.internalBinaryWrite(message.assets[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string next_page_token = 2; */
        if (message.nextPageToken !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.nextPageToken);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.ListVoiceAssetsResponse
 */
export const ListVoiceAssetsResponse = new ListVoiceAssetsResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteVoiceAssetRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.DeleteVoiceAssetRequest", [
            { no: 1, name: "voice_asset_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.voiceAssetId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string voice_asset_id */ 1:
                    message.voiceAssetId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string voice_asset_id = 1; */
        if (message.voiceAssetId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.voiceAssetId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.DeleteVoiceAssetRequest
 */
export const DeleteVoiceAssetRequest = new DeleteVoiceAssetRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class DeleteVoiceAssetResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.DeleteVoiceAssetResponse", [
            { no: 1, name: "ack", kind: "message", T: () => Ack }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* nimi.runtime.v1.Ack ack */ 1:
                    message.ack = Ack.internalBinaryRead(reader, reader.uint32(), options, message.ack);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* nimi.runtime.v1.Ack ack = 1; */
        if (message.ack)
            Ack.internalBinaryWrite(message.ack, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.DeleteVoiceAssetResponse
 */
export const DeleteVoiceAssetResponse = new DeleteVoiceAssetResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListPresetVoicesRequest$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.ListPresetVoicesRequest", [
            { no: 1, name: "app_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 2, name: "subject_user_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "model_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 4, name: "target_model_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 5, name: "connector_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.appId = "";
        message.subjectUserId = "";
        message.modelId = "";
        message.targetModelId = "";
        message.connectorId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string app_id */ 1:
                    message.appId = reader.string();
                    break;
                case /* string subject_user_id */ 2:
                    message.subjectUserId = reader.string();
                    break;
                case /* string model_id */ 3:
                    message.modelId = reader.string();
                    break;
                case /* string target_model_id */ 4:
                    message.targetModelId = reader.string();
                    break;
                case /* string connector_id */ 5:
                    message.connectorId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* string app_id = 1; */
        if (message.appId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.appId);
        /* string subject_user_id = 2; */
        if (message.subjectUserId !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.subjectUserId);
        /* string model_id = 3; */
        if (message.modelId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.modelId);
        /* string target_model_id = 4; */
        if (message.targetModelId !== "")
            writer.tag(4, WireType.LengthDelimited).string(message.targetModelId);
        /* string connector_id = 5; */
        if (message.connectorId !== "")
            writer.tag(5, WireType.LengthDelimited).string(message.connectorId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.ListPresetVoicesRequest
 */
export const ListPresetVoicesRequest = new ListPresetVoicesRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ListPresetVoicesResponse$Type extends MessageType {
    constructor() {
        super("nimi.runtime.v1.ListPresetVoicesResponse", [
            { no: 1, name: "voices", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => VoicePresetDescriptor },
            { no: 2, name: "model_resolved", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
            { no: 3, name: "trace_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
        ]);
    }
    create(value) {
        const message = globalThis.Object.create((this.messagePrototype));
        message.voices = [];
        message.modelResolved = "";
        message.traceId = "";
        if (value !== undefined)
            reflectionMergePartial(this, message, value);
        return message;
    }
    internalBinaryRead(reader, length, options, target) {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* repeated nimi.runtime.v1.VoicePresetDescriptor voices */ 1:
                    message.voices.push(VoicePresetDescriptor.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* string model_resolved */ 2:
                    message.modelResolved = reader.string();
                    break;
                case /* string trace_id */ 3:
                    message.traceId = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }
    internalBinaryWrite(message, writer, options) {
        /* repeated nimi.runtime.v1.VoicePresetDescriptor voices = 1; */
        for (let i = 0; i < message.voices.length; i++)
            VoicePresetDescriptor.internalBinaryWrite(message.voices[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* string model_resolved = 2; */
        if (message.modelResolved !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.modelResolved);
        /* string trace_id = 3; */
        if (message.traceId !== "")
            writer.tag(3, WireType.LengthDelimited).string(message.traceId);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }
}
/**
 * @generated MessageType for protobuf message nimi.runtime.v1.ListPresetVoicesResponse
 */
export const ListPresetVoicesResponse = new ListPresetVoicesResponse$Type();
//# sourceMappingURL=voice.js.map