"""Timeline response schemas."""

from datetime import datetime

from pydantic import BaseModel, ConfigDict

from app.models.event import EventPhase, SeverityLevel


class TimelineEventRead(BaseModel):
    """Serialized event fields used by timeline views."""

    model_config = ConfigDict(from_attributes=True)

    id: int
    ts: datetime
    phase: EventPhase
    title: str
    severity: SeverityLevel
    source: str
    tags: list[str]


class TimelineGroupedRead(BaseModel):
    """Timeline payload grouped by phase."""

    engagement_id: int
    phases: dict[str, list[TimelineEventRead]]
