"""Event schemas for API validation."""

import uuid
from datetime import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field


class EventCreate(BaseModel):
    """Schema for creating a new event."""

    tenant_id: uuid.UUID
    task_id: uuid.UUID | None = None
    event_type: str = Field(
        ...,
        min_length=1,
        max_length=100,
        description="Event type identifier (e.g. agent.registered, task.completed)",
    )
    payload: dict[str, Any] = Field(
        default_factory=dict,
        description="Event-specific payload data",
    )


class EventResponse(BaseModel):
    """Schema for event response."""

    model_config = ConfigDict(from_attributes=True)

    id: uuid.UUID
    tenant_id: uuid.UUID
    task_id: uuid.UUID | None
    event_type: str
    payload: dict[str, Any]
    created_at: datetime
