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

import typing

import pydantic
import typing_extensions
from ....core.pydantic_utilities import IS_PYDANTIC_V2
from ....core.serialization import FieldMetadata
from ....core.unchecked_base_model import UncheckedBaseModel
from .lightning_speech_to_text_response_age import LightningSpeechToTextResponseAge
from .lightning_speech_to_text_response_emotions import LightningSpeechToTextResponseEmotions
from .lightning_speech_to_text_response_gender import LightningSpeechToTextResponseGender
from .lightning_speech_to_text_response_metadata import LightningSpeechToTextResponseMetadata
from .lightning_speech_to_text_response_utterances_item import LightningSpeechToTextResponseUtterancesItem
from .lightning_speech_to_text_response_words_item import LightningSpeechToTextResponseWordsItem


class LightningSpeechToTextResponse(UncheckedBaseModel):
    status: typing.Optional[str] = pydantic.Field(default=None)
    """
    Status of the transcription request
    """

    text: typing_extensions.Annotated[
        typing.Optional[str],
        FieldMetadata(alias="transcription"),
        pydantic.Field(alias="transcription", description="The transcribed text from the audio file"),
    ] = None
    audio_length: typing.Optional[float] = pydantic.Field(default=None)
    """
    Duration of the audio file in seconds
    """

    words: typing.Optional[typing.List[LightningSpeechToTextResponseWordsItem]] = pydantic.Field(default=None)
    """
    Word-level timestamps in seconds.
    """

    utterances: typing.Optional[typing.List[LightningSpeechToTextResponseUtterancesItem]] = pydantic.Field(default=None)
    """
    List of utterances with start and end times
    """

    age: typing.Optional[LightningSpeechToTextResponseAge] = pydantic.Field(default=None)
    """
    Predicted age group of the speaker (e.g., infant, teenager, adult, old)
    """

    gender: typing.Optional[LightningSpeechToTextResponseGender] = pydantic.Field(default=None)
    """
    Predicted gender of the speaker if requested
    """

    emotions: typing.Optional[LightningSpeechToTextResponseEmotions] = pydantic.Field(default=None)
    """
    Predicted emotions of the speaker if requested
    """

    metadata: typing.Optional[LightningSpeechToTextResponseMetadata] = pydantic.Field(default=None)
    """
    Metadata about the transcription
    """

    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
