import type { SpeechCatalog, SpeechTtsModelConfig, SpeechVoiceOption } from "../../types/speech";

const MINIMAX_TTS_LANGUAGES = [
    "zh-Hans",
    "en-US",
    "ja-JP",
    "ko-KR",
    "es-ES",
    "fr-FR",
    "de-DE",
    "ru-RU",
    "ar",
    "pt-PT",
    "it-IT",
    "th-TH",
    "vi",
    "id-ID",
    "tr",
    "pl",
    "nl",
    "uk",
    "el",
    "hi",
    "ms",
    "fa",
    "sv",
    "cs",
    "fi",
    "da",
    "he",
    "hu",
    "no",
    "ro",
    "sk",
    "sl",
    "ca",
    "af",
    "tl",
    "ta",
];

const MINIMAX_TTS_VOICES: SpeechVoiceOption[] = [
    { id: "English_expressive_narrator", name: "Expressive Narrator", languages: ["en-US"] },
    { id: "English_radiant_girl", name: "Radiant Girl", languages: ["en-US"] },
    { id: "English_Graceful_Lady", name: "Graceful Lady", languages: ["en-US"] },
    { id: "English_CalmWoman", name: "Calm Woman", languages: ["en-US"] },
    { id: "English_Comedian", name: "Comedian", languages: ["en-US"] },
    { id: "English_Kind-heartedGirl", name: "Kind-Hearted Girl", languages: ["en-US"] },
    { id: "English_Insightful_Speaker", name: "Insightful Speaker", languages: ["en-US"] },
    { id: "English_Persuasive_Man", name: "Persuasive Man", languages: ["en-US"] },
    { id: "Chinese (Mandarin)_Lyrical_Voice", name: "Lyrical Voice", languages: ["zh-Hans"] },
    {
        id: "Chinese (Mandarin)_HK_Flight_Attendant",
        name: "HK Flight Attendant",
        languages: ["zh-Hans"],
    },
    {
        id: "Chinese (Mandarin)_Reliable_Executive",
        name: "Reliable Executive",
        languages: ["zh-Hans"],
    },
    { id: "Chinese (Mandarin)_News_Anchor", name: "News Anchor", languages: ["zh-Hans"] },
    { id: "Chinese (Mandarin)_Mature_Woman", name: "Mature Woman", languages: ["zh-Hans"] },
    { id: "Chinese (Mandarin)_Warm_Girl", name: "Warm Girl", languages: ["zh-Hans"] },
    { id: "Chinese (Mandarin)_Sweet_Lady", name: "Sweet Lady", languages: ["zh-Hans"] },
    { id: "Japanese_Whisper_Belle", name: "Whisper Belle", languages: ["ja-JP"] },
    { id: "Japanese_KindLady", name: "Kind Lady", languages: ["ja-JP"] },
    { id: "Japanese_CalmLady", name: "Calm Lady", languages: ["ja-JP"] },
    { id: "Japanese_GracefulMaiden", name: "Graceful Maiden", languages: ["ja-JP"] },
];

const MINIMAX_TTS_MODELS: SpeechTtsModelConfig[] = [
    {
        modelId: "speech-2.8-hd",
        label: "speech-2.8-hd",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-2.8-turbo",
        label: "speech-2.8-turbo",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-2.6-hd",
        label: "speech-2.6-hd",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-2.6-turbo",
        label: "speech-2.6-turbo",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-02-hd",
        label: "speech-02-hd",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-02-turbo",
        label: "speech-02-turbo",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-01-hd",
        label: "speech-01-hd",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
    {
        modelId: "speech-01-turbo",
        label: "speech-01-turbo",
        defaultVoiceId: "English_expressive_narrator",
        voices: MINIMAX_TTS_VOICES,
        supportedLanguages: MINIMAX_TTS_LANGUAGES,
        outputFormats: ["mp3", "pcm", "flac"],
        defaultOutputFormat: "mp3",
        speedRange: [0.5, 2],
        defaultSpeed: 1,
        maxInputLength: 10000,
    },
];

export const minimaxSpeechConfig: SpeechCatalog = {
    providerId: "minimax",
    providerName: "MiniMax",
    tts: {
        models: MINIMAX_TTS_MODELS,
    },
    transcription: {
        models: [],
    },
};
