# ruff: noqa: TC001

from __future__ import annotations

from typing import Literal, TypeAlias

from typing_extensions import Required, TypedDict

from .chat_completion_content_part_refusal_param import ChatCompletionContentPartRefusalParam
from .chat_completion_content_part_text_param import ChatCompletionContentPartTextParam
from .chat_completion_message_tool_call_union_param import ChatCompletionMessageToolCallUnionParam


__all__ = ["Audio", "ChatCompletionAssistantMessageParam", "ContentArrayOfContentPart"]


class Audio(TypedDict, total=False):
    id: Required[str]
    """Unique identifier for a previous audio response from the model."""


ContentArrayOfContentPart: TypeAlias = (
    ChatCompletionContentPartTextParam | ChatCompletionContentPartRefusalParam
)


class ChatCompletionAssistantMessageParam(TypedDict, total=False):
    role: Required[Literal["assistant"]]
    """The role of the messages author, in this case `assistant`."""

    audio: Audio | None
    """
    Data about a previous audio response from the model.
    [Learn more](https://platform.openai.com/docs/guides/audio).
    """

    content: str | list[ContentArrayOfContentPart] | ContentArrayOfContentPart | None
    """The contents of the assistant message.

    Required unless `tool_calls` or `function_call` is specified.
    """

    refusal: str | None
    """The refusal message by the assistant."""

    tool_calls: (
        list[ChatCompletionMessageToolCallUnionParam] | ChatCompletionMessageToolCallUnionParam
    )
    """The tool calls generated by the model, such as function calls."""

    chat_time: str | None
    """Optional timestamp for the message, format is not
    restricted, it can be any vague or precise time string."""

    message_id: str | None
    """Optional unique identifier for the message"""
