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

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .message_event_rcs_button_data_button import MessageEventRcsButtonDataButton
from .message_event_rcs_cards_content_cards_item import MessageEventRcsCardsContentCardsItem
from .message_event_rcs_location_data_data import MessageEventRcsLocationDataData
from .rich_button import RichButton


class MessageEventContent_Sms(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["SMS"] = "SMS"
    id: str
    text: str

    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 MessageEventContent_Mms(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["MMS"] = "MMS"
    id: str
    media_urls: typing_extensions.Annotated[typing.List[str], FieldMetadata(alias="mediaUrls")]
    text: typing.Optional[str] = None

    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 MessageEventContent_RcsText(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["RCS_TEXT"] = "RCS_TEXT"
    id: str
    quick_replies: typing_extensions.Annotated[typing.List[RichButton], FieldMetadata(alias="quickReplies")]
    text: str

    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 MessageEventContent_RcsMedia(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["RCS_MEDIA"] = "RCS_MEDIA"
    id: str
    media: str
    quick_replies: typing_extensions.Annotated[typing.List[RichButton], FieldMetadata(alias="quickReplies")]

    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 MessageEventContent_RcsCards(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["RCS_CARDS"] = "RCS_CARDS"
    id: str
    cards: typing.List[MessageEventRcsCardsContentCardsItem]
    quick_replies: typing_extensions.Annotated[typing.List[RichButton], FieldMetadata(alias="quickReplies")]

    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 MessageEventContent_RcsButtonData(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["RCS_BUTTON_DATA"] = "RCS_BUTTON_DATA"
    id: str
    button: MessageEventRcsButtonDataButton
    message_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="messageId")] = None

    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 MessageEventContent_RcsLocationData(UniversalBaseModel):
    """
    Content of an incoming or outgoing message. Discriminated by the `type` field.
    """

    type: typing.Literal["RCS_LOCATION_DATA"] = "RCS_LOCATION_DATA"
    id: str
    data: MessageEventRcsLocationDataData
    message_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="messageId")] = None

    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


MessageEventContent = typing.Union[
    MessageEventContent_Sms,
    MessageEventContent_Mms,
    MessageEventContent_RcsText,
    MessageEventContent_RcsMedia,
    MessageEventContent_RcsCards,
    MessageEventContent_RcsButtonData,
    MessageEventContent_RcsLocationData,
]
