"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 057aecb07275

from __future__ import annotations
from .assistantmessage import AssistantMessage, AssistantMessageTypedDict
from .systemmessage import SystemMessage, SystemMessageTypedDict
from .toolmessage import ToolMessage, ToolMessageTypedDict
from .usermessage import UserMessage, UserMessageTypedDict
from mistralai.client.types import BaseModel
from mistralai.client.utils import get_discriminator
import pydantic
from pydantic import Discriminator, Tag
from typing import List, Union
from typing_extensions import Annotated, TypeAliasType, TypedDict


ChatModerationRequestInputs2TypedDict = TypeAliasType(
    "ChatModerationRequestInputs2TypedDict",
    Union[
        SystemMessageTypedDict,
        UserMessageTypedDict,
        AssistantMessageTypedDict,
        ToolMessageTypedDict,
    ],
)


ChatModerationRequestInputs2 = Annotated[
    Union[
        Annotated[AssistantMessage, Tag("assistant")],
        Annotated[SystemMessage, Tag("system")],
        Annotated[ToolMessage, Tag("tool")],
        Annotated[UserMessage, Tag("user")],
    ],
    Discriminator(lambda m: get_discriminator(m, "role", "role")),
]


ChatModerationRequestInputs1TypedDict = TypeAliasType(
    "ChatModerationRequestInputs1TypedDict",
    Union[
        SystemMessageTypedDict,
        UserMessageTypedDict,
        AssistantMessageTypedDict,
        ToolMessageTypedDict,
    ],
)


ChatModerationRequestInputs1 = Annotated[
    Union[
        Annotated[AssistantMessage, Tag("assistant")],
        Annotated[SystemMessage, Tag("system")],
        Annotated[ToolMessage, Tag("tool")],
        Annotated[UserMessage, Tag("user")],
    ],
    Discriminator(lambda m: get_discriminator(m, "role", "role")),
]


ChatModerationRequestInputs3TypedDict = TypeAliasType(
    "ChatModerationRequestInputs3TypedDict",
    Union[
        List[ChatModerationRequestInputs1TypedDict],
        List[List[ChatModerationRequestInputs2TypedDict]],
    ],
)
r"""Chat to classify"""


ChatModerationRequestInputs3 = TypeAliasType(
    "ChatModerationRequestInputs3",
    Union[List[ChatModerationRequestInputs1], List[List[ChatModerationRequestInputs2]]],
)
r"""Chat to classify"""


class ChatModerationRequestTypedDict(TypedDict):
    inputs: ChatModerationRequestInputs3TypedDict
    r"""Chat to classify"""
    model: str


class ChatModerationRequest(BaseModel):
    inputs: Annotated[ChatModerationRequestInputs3, pydantic.Field(alias="input")]
    r"""Chat to classify"""

    model: str


try:
    ChatModerationRequest.model_rebuild()
except NameError:
    pass
