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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .message_role import MessageRole
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class InputMessage(UniversalBaseModel):
    """
    This is distinct from a ChatMessage because this schema is enforced by the AI Chat library used in the frontend
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    ID of the message, if any. a UUID.
    """

    role: MessageRole
    content: str
    data: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Additional data to be stored with the message.
    """

    class_name: 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
