"""Schemas for the /api/v1/admin/audit-logs endpoint."""

from __future__ import annotations

from datetime import datetime
from typing import Optional

from pydantic import BaseModel


class AuditLogItem(BaseModel):
    """One audit-log row as returned to the CMS."""

    id: int
    created_at: datetime
    action: str
    admin_user_id: Optional[str] = None
    admin_email: Optional[str] = None
    target_user_id: Optional[str] = None
    target_email: Optional[str] = None
    details: Optional[str] = None
    ip_address: Optional[str] = None
    user_agent: Optional[str] = None

    class Config:
        from_attributes = True


class AuditLogListResponse(BaseModel):
    """Paginated audit-log list response."""

    items: list[AuditLogItem]
    total: int
    page: int
    page_size: int
    known_actions: list[str]