# 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


class Response_Chunk(UniversalBaseModel):
    """
    Examples
    --------
    {"context_id": "abc", "data": "base64", "type": "chunk"}
    """

    type: typing.Literal["chunk"] = "chunk"
    context_id: str
    data: str

    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 Response_Done(UniversalBaseModel):
    """
    Examples
    --------
    {"context_id": "abc", "data": "base64", "type": "chunk"}
    """

    type: typing.Literal["done"] = "done"
    context_id: str

    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 Response_Error(UniversalBaseModel):
    """
    Examples
    --------
    {"context_id": "abc", "data": "base64", "type": "chunk"}
    """

    type: typing.Literal["error"] = "error"
    error: str
    status_code: int
    context_id: typing.Optional[str] = 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


"""
{"context_id": "abc", "data": "base64", "type": "chunk"}
"""
Response = typing.Union[Response_Chunk, Response_Done, Response_Error]
