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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .dialogue_text_alignment import DialogueTextAlignment


class TextToDialogueWebsocketAudioChunk(UncheckedBaseModel):
    """
    Server chunk containing encoded audio and optional alignment metadata.
    """

    audio: typing.Optional[str] = pydantic.Field(default=None)
    """
    Base64-encoded audio bytes for the selected `output_format`.
    """

    alignment: typing.Optional[DialogueTextAlignment] = pydantic.Field(default=None)
    """
    Present when `sync_alignment` query parameter is `true` and the model returned timing data for the chunk.
    """

    normalized_alignment: typing.Optional[DialogueTextAlignment] = pydantic.Field(default=None)
    """
    Reserved for future use; currently unused by the server.
    """

    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
