from enum import Enum
from typing import Any

from pydantic import BaseModel


class RIEndpoint(str, Enum):
    """
    Enumeration of valid endpoints for the Robot Interface (RI).
    """

    SPEECH = "actuate/speech"
    PING = "ping"
    NEGOTIATE_PORTS = "negotiate/ports"


class RIMessage(BaseModel):
    """
    Base schema for messages sent to the Robot Interface.

    :ivar endpoint: The target endpoint/action on the RI.
    :ivar data: The payload associated with the action.
    """

    endpoint: RIEndpoint
    data: Any


class SpeechCommand(RIMessage):
    """
    A specific command to make the robot speak.

    :ivar endpoint: Fixed to ``RIEndpoint.SPEECH``.
    :ivar data: The text string to be spoken.
    """

    endpoint: RIEndpoint = RIEndpoint(RIEndpoint.SPEECH)
    data: str
