# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .approval_request_message_tool_call import ApprovalRequestMessageToolCall
from .approval_request_message_tool_calls import ApprovalRequestMessageToolCalls


class ApprovalRequestMessage(UncheckedBaseModel):
    """
    A message representing a request for approval to call a tool (generated by the LLM to trigger tool execution).

    Args:
        id (str): The ID of the message
        date (datetime): The date the message was created in ISO format
        name (Optional[str]): The name of the sender of the message
        tool_call (ToolCall): The tool call
    """

    id: str
    date: dt.datetime
    name: typing.Optional[str] = None
    message_type: typing.Literal["approval_request_message"] = "approval_request_message"
    otid: typing.Optional[str] = None
    sender_id: typing.Optional[str] = None
    step_id: typing.Optional[str] = None
    is_err: typing.Optional[bool] = None
    seq_id: typing.Optional[int] = None
    run_id: typing.Optional[str] = None
    tool_call: ApprovalRequestMessageToolCall = pydantic.Field()
    """
    The tool call that has been requested by the llm to run
    """

    tool_calls: typing.Optional[ApprovalRequestMessageToolCalls] = pydantic.Field(default=None)
    """
    The tool calls that have been requested by the llm to run, which are pending approval
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
