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

from __future__ import annotations
from .inputaudio import InputAudio, InputAudioTypedDict
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


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


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


OpenAIResponseInputMessageItemRoleDeveloper = Literal["developer",]


OpenAIResponseInputMessageItemRoleSystem = Literal["system",]


OpenAIResponseInputMessageItemRoleUser = Literal["user",]


OpenAIResponseInputMessageItemRoleUnionTypedDict = TypeAliasType(
    "OpenAIResponseInputMessageItemRoleUnionTypedDict",
    Union[
        OpenAIResponseInputMessageItemRoleUser,
        OpenAIResponseInputMessageItemRoleSystem,
        OpenAIResponseInputMessageItemRoleDeveloper,
    ],
)


OpenAIResponseInputMessageItemRoleUnion = TypeAliasType(
    "OpenAIResponseInputMessageItemRoleUnion",
    Union[
        OpenAIResponseInputMessageItemRoleUser,
        OpenAIResponseInputMessageItemRoleSystem,
        OpenAIResponseInputMessageItemRoleDeveloper,
    ],
)


OpenAIResponseInputMessageItemType = Literal["message",]


class OpenAIResponseInputMessageItemTypedDict(TypedDict):
    content: List[OpenAIResponseInputMessageItemContentTypedDict]
    id: str
    role: OpenAIResponseInputMessageItemRoleUnionTypedDict
    type: NotRequired[OpenAIResponseInputMessageItemType]


class OpenAIResponseInputMessageItem(BaseModel):
    content: List[OpenAIResponseInputMessageItemContent]

    id: str

    role: OpenAIResponseInputMessageItemRoleUnion

    type: Optional[OpenAIResponseInputMessageItemType] = None
