"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from .inputfile import InputFile, InputFileTypedDict
from .inputimage import InputImage, InputImageTypedDict
from .inputtext import InputText, InputTextTypedDict
from openrouter.types import BaseModel
from openrouter.utils import get_discriminator
from pydantic import Discriminator, Tag
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


OpenAIResponseCustomToolCallOutputOutput1TypedDict = TypeAliasType(
    "OpenAIResponseCustomToolCallOutputOutput1TypedDict",
    Union[InputTextTypedDict, InputImageTypedDict, InputFileTypedDict],
)


OpenAIResponseCustomToolCallOutputOutput1 = Annotated[
    Union[
        Annotated[InputFile, Tag("input_file")],
        Annotated[InputImage, Tag("input_image")],
        Annotated[InputText, Tag("input_text")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]


OpenAIResponseCustomToolCallOutputOutput2TypedDict = TypeAliasType(
    "OpenAIResponseCustomToolCallOutputOutput2TypedDict",
    Union[str, List[OpenAIResponseCustomToolCallOutputOutput1TypedDict]],
)


OpenAIResponseCustomToolCallOutputOutput2 = TypeAliasType(
    "OpenAIResponseCustomToolCallOutputOutput2",
    Union[str, List[OpenAIResponseCustomToolCallOutputOutput1]],
)


OpenAIResponseCustomToolCallOutputType = Literal["custom_tool_call_output",]


class OpenAIResponseCustomToolCallOutputTypedDict(TypedDict):
    call_id: str
    output: OpenAIResponseCustomToolCallOutputOutput2TypedDict
    type: OpenAIResponseCustomToolCallOutputType
    id: NotRequired[str]


class OpenAIResponseCustomToolCallOutput(BaseModel):
    call_id: str

    output: OpenAIResponseCustomToolCallOutputOutput2

    type: OpenAIResponseCustomToolCallOutputType

    id: Optional[str] = None
