# 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
from ..core.serialization import FieldMetadata
from .annotations import Annotations
from .resource import Resource


class CallToolResultContentItem_Text(UniversalBaseModel):
    type: typing.Literal["text"] = "text"
    text: str
    annotations: typing.Optional[Annotations] = None
    meta: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="_meta")
    ] = 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 CallToolResultContentItem_Image(UniversalBaseModel):
    type: typing.Literal["image"] = "image"
    data: str
    mime_type: typing_extensions.Annotated[str, FieldMetadata(alias="mimeType")]
    annotations: typing.Optional[Annotations] = None
    meta: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="_meta")
    ] = 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 CallToolResultContentItem_Audio(UniversalBaseModel):
    type: typing.Literal["audio"] = "audio"
    data: str
    mime_type: typing_extensions.Annotated[str, FieldMetadata(alias="mimeType")]
    annotations: typing.Optional[Annotations] = None
    meta: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="_meta")
    ] = 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 CallToolResultContentItem_ResourceLink(UniversalBaseModel):
    type: typing.Literal["resource_link"] = "resource_link"
    name: str
    title: typing.Optional[str] = None
    uri: str
    description: typing.Optional[str] = None
    mime_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="mimeType")] = None
    size: typing.Optional[int] = None
    annotations: typing.Optional[Annotations] = None
    meta: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="_meta")
    ] = 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 CallToolResultContentItem_Resource(UniversalBaseModel):
    type: typing.Literal["resource"] = "resource"
    resource: Resource
    annotations: typing.Optional[Annotations] = None
    meta: typing_extensions.Annotated[
        typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="_meta")
    ] = 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


CallToolResultContentItem = typing.Union[
    CallToolResultContentItem_Text,
    CallToolResultContentItem_Image,
    CallToolResultContentItem_Audio,
    CallToolResultContentItem_ResourceLink,
    CallToolResultContentItem_Resource,
]
