# 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_error import DubbingError
from .dubbing_project_response_status import DubbingProjectResponseStatus
from .dubbing_source_media_info import DubbingSourceMediaInfo
from .voices_not_permitted_warning import VoicesNotPermittedWarning


class DubbingProjectResponse(UncheckedBaseModel):
    project_id: str = pydantic.Field()
    """
    Unique identifier of the dubbing project.
    """

    status: DubbingProjectResponseStatus = pydantic.Field()
    """
    Lifecycle status of the project: 'preparing'/'processing' while it transcribes, 'ready' once transcription is done, or 'failed'.
    """

    reference: typing.Optional[str] = pydantic.Field(default=None)
    """
    Optional free-form string the customer can provide to identify the project on their end.
    """

    source_language: typing.Optional[str] = pydantic.Field(default=None)
    """
    BCP-47 language tag of the source media (null if auto-detected).
    """

    model_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Default dubbing model id applied to this project's language targets.
    """

    media: typing.Optional[DubbingSourceMediaInfo] = pydantic.Field(default=None)
    """
    Source media metadata; null until the project is ready.
    """

    language_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Identifiers of the language targets created under this project.
    """

    webhook_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Workspace webhooks notified when this project becomes ready or fails, and when any of its languages completes or fails.
    """

    revision: int = pydantic.Field()
    """
    Monotonic counter incremented whenever the source transcript is edited (segment add/edit/delete).
    """

    error: typing.Optional[DubbingError] = pydantic.Field(default=None)
    """
    Why the project failed; null unless `status` is 'failed'. Also null for the few projects that failed before failure reporting was introduced.
    """

    warnings: typing.Optional[typing.List[VoicesNotPermittedWarning]] = pydantic.Field(default=None)
    """
    Non-fatal conditions raised while preparing the source, empty when there are none. Reflects the latest preparation. Conditions raised while dubbing a particular language are reported on that language instead.
    """

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

    updated_at: dt.datetime = pydantic.Field()
    """
    When the project 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
