# 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


class AccessRightResponse(UniversalBaseModel):
    """
    Response schema for access right.
    """

    id: str = pydantic.Field()
    """
    Access right ID with racc_ prefix
    """

    rule_id: str = pydantic.Field()
    """
    Rule ID
    """

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

    access_level: str = pydantic.Field()
    """
    Access level (owner, edit, view)
    """

    granted_by: str = pydantic.Field()
    """
    User ID who granted the access
    """

    granted_at: dt.datetime = pydantic.Field()
    """
    Timestamp when access was granted
    """

    is_deleted: bool = pydantic.Field()
    """
    Whether access right is deleted
    """

    created_at: dt.datetime = pydantic.Field()
    """
    Creation timestamp
    """

    updated_at: dt.datetime = pydantic.Field()
    """
    Last update timestamp
    """

    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
