# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .aws_polly_speak_provider_credentials import AwsPollySpeakProviderCredentials
from .aws_polly_speak_provider_engine import AwsPollySpeakProviderEngine
from .aws_polly_speak_provider_voice import AwsPollySpeakProviderVoice
from .cartesia_speak_provider_model_id import CartesiaSpeakProviderModelId
from .cartesia_speak_provider_voice import CartesiaSpeakProviderVoice
from .deepgram_speak_provider_model import DeepgramSpeakProviderModel
from .eleven_labs_speak_provider_model_id import ElevenLabsSpeakProviderModelId
from .open_ai_speak_provider_model import OpenAiSpeakProviderModel
from .open_ai_speak_provider_voice import OpenAiSpeakProviderVoice


class SpeakSettingsV1Provider_Deepgram(UniversalBaseModel):
    type: typing.Literal["deepgram"] = "deepgram"
    version: typing.Optional[typing.Literal["v1"]] = None
    model: DeepgramSpeakProviderModel

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class SpeakSettingsV1Provider_ElevenLabs(UniversalBaseModel):
    type: typing.Literal["eleven_labs"] = "eleven_labs"
    version: typing.Optional[typing.Literal["v1"]] = None
    model_id: ElevenLabsSpeakProviderModelId
    language: typing.Optional[str] = None
    language_code: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class SpeakSettingsV1Provider_Cartesia(UniversalBaseModel):
    type: typing.Literal["cartesia"] = "cartesia"
    version: typing.Optional[typing.Literal["2025-03-17"]] = None
    model_id: CartesiaSpeakProviderModelId
    voice: CartesiaSpeakProviderVoice
    language: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class SpeakSettingsV1Provider_OpenAi(UniversalBaseModel):
    type: typing.Literal["open_ai"] = "open_ai"
    version: typing.Optional[typing.Literal["v1"]] = None
    model: OpenAiSpeakProviderModel
    voice: OpenAiSpeakProviderVoice

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class SpeakSettingsV1Provider_AwsPolly(UniversalBaseModel):
    type: typing.Literal["aws_polly"] = "aws_polly"
    voice: AwsPollySpeakProviderVoice
    language: str
    language_code: typing.Optional[str] = None
    engine: AwsPollySpeakProviderEngine
    credentials: AwsPollySpeakProviderCredentials

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


SpeakSettingsV1Provider = typing_extensions.Annotated[
    typing.Union[
        SpeakSettingsV1Provider_Deepgram,
        SpeakSettingsV1Provider_ElevenLabs,
        SpeakSettingsV1Provider_Cartesia,
        SpeakSettingsV1Provider_OpenAi,
        SpeakSettingsV1Provider_AwsPolly,
    ],
    pydantic.Field(discriminator="type"),
]
