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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ...commons.types.entity_id_without_agent import EntityIdWithoutAgent
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ...core.serialization import FieldMetadata
from .conversation_message_request import ConversationMessageRequest


class DeliverMessageRequest_User(UniversalBaseModel):
    type: typing.Literal["user"] = "user"
    user_id: typing_extensions.Annotated[EntityIdWithoutAgent, FieldMetadata(alias="userId")]
    message: ConversationMessageRequest

    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


class DeliverMessageRequest_Conversation(UniversalBaseModel):
    type: typing.Literal["conversation"] = "conversation"
    conversation_id: typing_extensions.Annotated[EntityIdWithoutAgent, FieldMetadata(alias="conversationId")]
    message: ConversationMessageRequest

    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


DeliverMessageRequest = typing.Union[DeliverMessageRequest_User, DeliverMessageRequest_Conversation]
