# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .audit_log_category import AuditLogCategory
from .audit_log_level import AuditLogLevel


class AuditLog(UniversalBaseModel):
    """
    Audit log response schema.
    """

    category: AuditLogCategory
    level: AuditLogLevel
    action: str
    details: str
    actor: str
    actor_email: typing.Optional[str] = None
    actor_type: typing.Optional[str] = None
    user_id: typing.Optional[str] = None
    api_key_id: typing.Optional[str] = None
    agent_api_key_id: typing.Optional[str] = None
    search_query_id: typing.Optional[str] = None
    sync_job_id: typing.Optional[str] = None
    status_code: typing.Optional[int] = None
    ip_address: typing.Optional[str] = None
    event_metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    trace: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    id: str
    organization_id: str
    collection_id: str
    created_at: typing.Optional[dt.datetime] = None
    modified_at: typing.Optional[dt.datetime] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
