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

from ...core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .posted_utterance_voice import PostedUtteranceVoice
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class PostedUtterance(UniversalBaseModel):
    description: typing.Optional[str] = pydantic.Field(default=None)
    """
    Natural language instructions describing how the synthesized speech should sound, including  but not limited to tone, intonation, pacing, and accent (e.g., 'a soft, gentle voice with a strong British  accent').
    - If a Voice is specified in the request, this description serves as acting instructions.
    - If  no Voice is specified, a new voice is generated based on this description.
    
     See our  [prompting guide](/docs/text-to-speech-tts/prompting) for tips on crafting your descriptions.
    """

    speed: typing.Optional[float] = pydantic.Field(default=None)
    """
    Speed multiplier for the synthesized speech.
    """

    text: str = pydantic.Field()
    """
    The input text to be synthesized into speech.
    """

    trailing_silence: typing.Optional[float] = pydantic.Field(default=None)
    """
    Duration of trailing silence (in seconds) to add to this utterance
    """

    voice: typing.Optional[PostedUtteranceVoice] = pydantic.Field(default=None)
    """
    The `name` or `id` associated with a **Voice** from the **Voice Library** to be used as the  speaker for this and all subsequent `utterances`, until the `voice` field is updated again.
    
     See our  [voices guide](/docs/text-to-speech-tts/voices) for more details on generating and specifying **Voices**.
    """

    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
