from datetime import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict


class AuditLogResponse(BaseModel):
    id: int
    actor_user_id: int | None
    actor_username: str
    action: str
    entity_type: str
    entity_id: int | None
    entity_label: str
    ip_address: str
    user_agent: str
    before_data: Any = None
    after_data: Any = None
    metadata_data: Any = None
    created_at: datetime

    model_config = ConfigDict(from_attributes=True)


class AuditLogListResponse(BaseModel):
    items: list[AuditLogResponse]
    total: int
    page: int
    page_size: int


class ActivityFeedItem(BaseModel):
    id: int
    title: str
    description: str
    actor: str
    entity_type: str
    entity_id: int | None
    created_at: datetime
