# 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 .chapter_state import ChapterState
from .chapter_statistics_response import ChapterStatisticsResponse


class ChapterResponse(UncheckedBaseModel):
    chapter_id: str = pydantic.Field()
    """
    The ID of the chapter.
    """

    name: str = pydantic.Field()
    """
    The name of the chapter.
    """

    last_conversion_date_unix: typing.Optional[int] = pydantic.Field(default=None)
    """
    The last conversion date of the chapter.
    """

    conversion_progress: typing.Optional[float] = pydantic.Field(default=None)
    """
    The conversion progress of the chapter.
    """

    can_be_downloaded: bool = pydantic.Field()
    """
    Whether the chapter can be downloaded.
    """

    state: ChapterState = pydantic.Field()
    """
    The state of the chapter.
    """

    has_video: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether the chapter has a video.
    """

    has_visual_content: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether the chapter has any visual content (video, image, or text clips).
    """

    voice_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    List of voice ids used by the chapter
    """

    statistics: typing.Optional[ChapterStatisticsResponse] = pydantic.Field(default=None)
    """
    The statistics of the chapter.
    """

    last_conversion_error: typing.Optional[str] = pydantic.Field(default=None)
    """
    The last conversion error of the chapter.
    """

    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
