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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .actor_model import ActorModel
from .device_model import DeviceModel
from .http_request_model import HttpRequestModel
from .severity_id import SeverityId
from .status_id import StatusId
from .workspace_audit_log_entry_response_activity_id import WorkspaceAuditLogEntryResponseActivityId


class WorkspaceAuditLogEntryResponse(UncheckedBaseModel):
    """
    Audit log entry with Firestore document ID for API responses.
    """

    metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Event metadata
    """

    time: typing.Optional[int] = pydantic.Field(default=None)
    """
    Event time in milliseconds since epoch
    """

    activity_id: WorkspaceAuditLogEntryResponseActivityId = pydantic.Field()
    """
    Activity ID
    """

    activity_name: str = pydantic.Field()
    """
    Activity name
    """

    category_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Event category
    """

    category_uid: typing.Optional[int] = pydantic.Field(default=None)
    """
    Category UID for IAM
    """

    class_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Event class name
    """

    class_uid: typing.Optional[int] = pydantic.Field(default=None)
    """
    Event class UID
    """

    severity_id: typing.Optional[SeverityId] = pydantic.Field(default=None)
    """
    Severity level
    """

    status_id: StatusId = pydantic.Field()
    """
    Status of the action
    """

    actor: ActorModel = pydantic.Field()
    """
    Actor performing the action
    """

    device: typing.Optional[DeviceModel] = pydantic.Field(default=None)
    """
    Device information
    """

    http_request: typing.Optional[HttpRequestModel] = pydantic.Field(default=None)
    """
    HTTP request details
    """

    message: str = pydantic.Field()
    """
    Human-readable event description
    """

    unmapped: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None)
    """
    Attributes not mapped to OCSF
    """

    id: str = pydantic.Field()
    """
    Firestore document ID
    """

    time_dt: typing.Optional[str] = pydantic.Field(default=None)
    """
    Event time in human-readable RFC 3339 format, derived from 'time'.
    """

    type_uid: typing.Optional[int] = pydantic.Field(default=None)
    """
    OCSF type_uid is class_uid * 100 + activity_id.
    """

    type_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    OCSF type_name combines class_name and activity_name.
    """

    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
