"""Pydantic v2 schemas for Notification responses."""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel


class NotificationResponse(BaseModel):
    """Single notification returned to the client."""

    id: int
    notification_type: str
    title: str
    message: Optional[str] = None
    related_entity_type: Optional[str] = None
    related_entity_id: Optional[int] = None
    is_read: bool
    created_at: datetime

    model_config = {"from_attributes": True}


class NotificationList(BaseModel):
    """Wrapper that includes an unread counter alongside the item list."""

    items: list[NotificationResponse]
    unread_count: int
