from datetime import datetime

from pydantic import BaseModel


class OperationLogOut(BaseModel):
    id: int
    admin_user_id: int | None
    action: str
    action_label: str | None = None
    object_type: str
    object_label: str | None = None
    object_id: str | None
    ip_address: str | None
    detail_json: str | None
    created_at: datetime
    risk: str | None = None
    risk_label: str | None = None
    summary: str | None = None

    model_config = {"from_attributes": True}


class OperationLogPage(BaseModel):
    items: list[OperationLogOut]
    total: int
    page: int
    page_size: int
    total_pages: int
