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

from __future__ import annotations
from .openairesponsesrefusalcontent import (
    OpenAIResponsesRefusalContent,
    OpenAIResponsesRefusalContentTypedDict,
)
from .responseoutputtext import ResponseOutputText, ResponseOutputTextTypedDict
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


ResponsesOutputMessageRole = Literal["assistant",]


ResponsesOutputMessageType = Literal["message",]


ResponsesOutputMessageStatusInProgress = Literal["in_progress",]


ResponsesOutputMessageStatusIncomplete = Literal["incomplete",]


ResponsesOutputMessageStatusCompleted = Literal["completed",]


ResponsesOutputMessageStatusUnionTypedDict = TypeAliasType(
    "ResponsesOutputMessageStatusUnionTypedDict",
    Union[
        ResponsesOutputMessageStatusCompleted,
        ResponsesOutputMessageStatusIncomplete,
        ResponsesOutputMessageStatusInProgress,
    ],
)


ResponsesOutputMessageStatusUnion = TypeAliasType(
    "ResponsesOutputMessageStatusUnion",
    Union[
        ResponsesOutputMessageStatusCompleted,
        ResponsesOutputMessageStatusIncomplete,
        ResponsesOutputMessageStatusInProgress,
    ],
)


ResponsesOutputMessageContentTypedDict = TypeAliasType(
    "ResponsesOutputMessageContentTypedDict",
    Union[OpenAIResponsesRefusalContentTypedDict, ResponseOutputTextTypedDict],
)


ResponsesOutputMessageContent = Annotated[
    Union[
        Annotated[ResponseOutputText, Tag("output_text")],
        Annotated[OpenAIResponsesRefusalContent, Tag("refusal")],
    ],
    Discriminator(lambda m: get_discriminator(m, "type", "type")),
]


class ResponsesOutputMessageTypedDict(TypedDict):
    r"""An output message item"""

    id: str
    role: ResponsesOutputMessageRole
    type: ResponsesOutputMessageType
    content: List[ResponsesOutputMessageContentTypedDict]
    status: NotRequired[ResponsesOutputMessageStatusUnionTypedDict]


class ResponsesOutputMessage(BaseModel):
    r"""An output message item"""

    id: str

    role: ResponsesOutputMessageRole

    type: ResponsesOutputMessageType

    content: List[ResponsesOutputMessageContent]

    status: Optional[ResponsesOutputMessageStatusUnion] = None
