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

from __future__ import annotations
from .chatcompletioncontentpartimageparam import (
    ChatCompletionContentPartImageParam,
    ChatCompletionContentPartImageParamTypedDict,
)
from .chatcompletioncontentpartinputaudioparam import (
    ChatCompletionContentPartInputAudioParam,
    ChatCompletionContentPartInputAudioParamTypedDict,
)
from .chatcompletioncontentparttextparam import (
    ChatCompletionContentPartTextParam,
    ChatCompletionContentPartTextParamTypedDict,
)
from .file import File, FileTypedDict
from opperai.types import BaseModel
from opperai.utils import validate_const
import pydantic
from pydantic.functional_validators import AfterValidator
from typing import List, Literal, Optional, Union
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict


ChatCompletionUserMessageParamContent1TypedDict = TypeAliasType(
    "ChatCompletionUserMessageParamContent1TypedDict",
    Union[
        ChatCompletionContentPartTextParamTypedDict,
        ChatCompletionContentPartImageParamTypedDict,
        ChatCompletionContentPartInputAudioParamTypedDict,
        FileTypedDict,
    ],
)


ChatCompletionUserMessageParamContent1 = TypeAliasType(
    "ChatCompletionUserMessageParamContent1",
    Union[
        ChatCompletionContentPartTextParam,
        ChatCompletionContentPartImageParam,
        ChatCompletionContentPartInputAudioParam,
        File,
    ],
)


ChatCompletionUserMessageParamContent2TypedDict = TypeAliasType(
    "ChatCompletionUserMessageParamContent2TypedDict",
    Union[str, List[ChatCompletionUserMessageParamContent1TypedDict]],
)


ChatCompletionUserMessageParamContent2 = TypeAliasType(
    "ChatCompletionUserMessageParamContent2",
    Union[str, List[ChatCompletionUserMessageParamContent1]],
)


class ChatCompletionUserMessageParamTypedDict(TypedDict):
    content: ChatCompletionUserMessageParamContent2TypedDict
    role: Literal["user"]
    name: NotRequired[str]


class ChatCompletionUserMessageParam(BaseModel):
    content: ChatCompletionUserMessageParamContent2

    ROLE: Annotated[
        Annotated[Literal["user"], AfterValidator(validate_const("user"))],
        pydantic.Field(alias="role"),
    ] = "user"

    name: Optional[str] = None
