# 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 .change_detail import ChangeDetail


class ChangeLogResponse(UniversalBaseModel):
    """
    Schema for change log entry.
    """

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

    user_id: str = pydantic.Field()
    """
    User who made the change
    """

    user_name: str = pydantic.Field()
    """
    Name of user who made the change
    """

    user_email: str = pydantic.Field()
    """
    Email of user who made the change
    """

    action: str = pydantic.Field()
    """
    Action performed (created, updated, deleted)
    """

    timestamp: dt.datetime = pydantic.Field()
    """
    When the change occurred
    """

    resource_type: str = pydantic.Field()
    """
    Type of resource changed
    """

    resource_id: str = pydantic.Field()
    """
    ID of the resource changed
    """

    resource_name: str = pydantic.Field()
    """
    Name of the resource changed
    """

    changes: typing.List[ChangeDetail] = pydantic.Field()
    """
    List of changes made
    """

    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
