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

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .summarize_chapter_result_chapters_item import SummarizeChapterResultChaptersItem
from .summarize_highlight_result_highlights_item import SummarizeHighlightResultHighlightsItem
from .token_usage import TokenUsage


class SummarizeResponse_Summary(UniversalBaseModel):
    summarize_type: typing.Literal["summary"] = "summary"
    id: typing.Optional[str] = None
    summary: typing.Optional[str] = None
    usage: typing.Optional[TokenUsage] = None

    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


class SummarizeResponse_Chapter(UniversalBaseModel):
    summarize_type: typing.Literal["chapter"] = "chapter"
    id: typing.Optional[str] = None
    chapters: typing.Optional[typing.List[SummarizeChapterResultChaptersItem]] = None
    usage: typing.Optional[TokenUsage] = None

    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


class SummarizeResponse_Highlight(UniversalBaseModel):
    summarize_type: typing.Literal["highlight"] = "highlight"
    id: typing.Optional[str] = None
    highlights: typing.Optional[typing.List[SummarizeHighlightResultHighlightsItem]] = None
    usage: typing.Optional[TokenUsage] = None

    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


SummarizeResponse = typing.Union[SummarizeResponse_Summary, SummarizeResponse_Chapter, SummarizeResponse_Highlight]
