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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class TaskMessageDelta_Data(UniversalBaseModel):
    type: typing.Literal["data"] = "data"
    data_delta: 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


class TaskMessageDelta_ReasoningContent(UniversalBaseModel):
    type: typing.Literal["reasoning_content"] = "reasoning_content"
    content_delta: typing.Optional[str] = None
    content_index: int

    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 TaskMessageDelta_ReasoningSummary(UniversalBaseModel):
    type: typing.Literal["reasoning_summary"] = "reasoning_summary"
    summary_delta: typing.Optional[str] = None
    summary_index: int

    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 TaskMessageDelta_Text(UniversalBaseModel):
    type: typing.Literal["text"] = "text"
    text_delta: 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


class TaskMessageDelta_ToolRequest(UniversalBaseModel):
    type: typing.Literal["tool_request"] = "tool_request"
    arguments_delta: typing.Optional[str] = None
    name: str
    tool_call_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 TaskMessageDelta_ToolResponse(UniversalBaseModel):
    type: typing.Literal["tool_response"] = "tool_response"
    content_delta: typing.Optional[str] = None
    name: str
    tool_call_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


TaskMessageDelta = typing_extensions.Annotated[
    typing.Union[
        TaskMessageDelta_Data,
        TaskMessageDelta_ReasoningContent,
        TaskMessageDelta_ReasoningSummary,
        TaskMessageDelta_Text,
        TaskMessageDelta_ToolRequest,
        TaskMessageDelta_ToolResponse,
    ],
    pydantic.Field(discriminator="type"),
]
