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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .change_schema import ChangeSchema


class AuditLogSchema(UniversalBaseModel):
    """
    Schema for audit log entry.
    """

    id: str = pydantic.Field()
    """
    Audit log ID
    """

    timestamp: int = pydantic.Field()
    """
    Unix timestamp
    """

    resource_type: str = pydantic.Field()
    """
    Resource type
    """

    resource_id: str = pydantic.Field()
    """
    Resource ID
    """

    resource_name: str = pydantic.Field()
    """
    Resource name
    """

    action: str = pydantic.Field()
    """
    Action performed
    """

    user_id: str = pydantic.Field()
    """
    User ID
    """

    user_name: str = pydantic.Field()
    """
    User name
    """

    user_email: str = pydantic.Field()
    """
    User email
    """

    changes: typing.Optional[typing.List[ChangeSchema]] = pydantic.Field(default=None)
    """
    Changes made
    """

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

    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
