from __future__ import annotations

from dataclasses import dataclass
from datetime import datetime, timezone
from typing import Literal


SessionMessageRole = Literal["user", "assistant"]


@dataclass(slots=True)
class AgentSessionMessage:
    role: SessionMessageRole
    text: str
    created_at: datetime

    @classmethod
    def create(cls, role: SessionMessageRole, text: str) -> "AgentSessionMessage":
        return cls(role=role, text=text, created_at=datetime.now(timezone.utc))
