# retoor <retoor@molodetz.nl>

from __future__ import annotations

from typing import Any, Optional

from devplacepy.schemas.base import _Out


class AuditLinkOut(_Out):
    uid: str = ""
    relation: str = ""
    object_type: str = ""
    object_uid: str = ""
    object_label: Optional[str] = None
    created_at: Optional[str] = None


class AuditEntryOut(_Out):
    uid: str = ""
    created_at: Optional[str] = None
    event_key: str = ""
    category: str = ""
    actor_kind: str = ""
    actor_uid: Optional[str] = None
    actor_username: Optional[str] = None
    actor_role: str = ""
    origin: str = ""
    via_agent: int = 0
    request_method: Optional[str] = None
    request_path: Optional[str] = None
    actor_ip: Optional[str] = None
    user_agent: Optional[str] = None
    target_type: Optional[str] = None
    target_uid: Optional[str] = None
    target_label: Optional[str] = None
    old_value: Optional[str] = None
    new_value: Optional[str] = None
    summary: Optional[str] = None
    metadata: Optional[Any] = None
    result: str = "success"


class AuditLogOut(_Out):
    entries: list[AuditEntryOut] = []
    pagination: Optional[dict] = None
    pagination_query: Optional[str] = None
    filters: dict = {}
    options: dict = {}
    admin_section: Optional[str] = None


class AuditEventOut(_Out):
    event: Optional[AuditEntryOut] = None
    links: list[AuditLinkOut] = []
    admin_section: Optional[str] = None
