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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .dubbing_language_outputs import DubbingLanguageOutputs
from .dubbing_language_response_status import DubbingLanguageResponseStatus
from .voice_settings import VoiceSettings


class DubbingLanguageResponse(UncheckedBaseModel):
    language_id: str = pydantic.Field()
    """
    Unique identifier of the language target.
    """

    project_id: str = pydantic.Field()
    """
    Identifier of the parent dubbing project.
    """

    target_language: str = pydantic.Field()
    """
    BCP-47 language tag this target is dubbed into.
    """

    status: DubbingLanguageResponseStatus = pydantic.Field()
    """
    Lifecycle status: 'queued' (waiting on the project), 'processing', 'completed', 'stale' (source/transcript changed), or 'failed'.
    """

    model_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Effective dubbing model id (target override or project default).
    """

    voice_settings: typing.Optional[VoiceSettings] = pydantic.Field(default=None)
    """
    Voice settings applied to the whole language, or null if unset.
    """

    outputs: typing.Optional[DubbingLanguageOutputs] = pydantic.Field(default=None)
    """
    Signed output URLs; null until the target has produced an output (present once 'completed', and kept while 'stale' -- compare `output_revision` against `revision` to tell whether the output is up to date).
    """

    revision: int = pydantic.Field()
    """
    Monotonic counter incremented whenever this target's transcript changes (a source edit affecting it, or an edit to its translation).
    """

    output_revision: typing.Optional[int] = pydantic.Field(default=None)
    """
    The `revision` the current dubbed output was generated from; equal to `revision` when up to date, less than it when 'stale'. Null until a generation has completed.
    """

    created_at: dt.datetime = pydantic.Field()
    """
    When the language target was created.
    """

    updated_at: dt.datetime = pydantic.Field()
    """
    When the language target was last updated.
    """

    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
