# 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 AccessGrantResponse(UniversalBaseModel):
    """
    Schema for access grant response.
    """

    id: str = pydantic.Field()
    """
    Unique identifier for the access grant
    """

    entity_type: str = pydantic.Field()
    """
    Type of entity: 'knowledge_slice', 'vector_store', or 'assistant'
    """

    entity_id: str = pydantic.Field()
    """
    ID of the entity access was granted to
    """

    grantee_type: str = pydantic.Field()
    """
    Type of grantee: 'user', 'department', or 'role'
    """

    grantee_id: str = pydantic.Field()
    """
    ID of the grantee who received access
    """

    grantee_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Display name of the grantee, if available
    """

    grantee_email: typing.Optional[str] = pydantic.Field(default=None)
    """
    Email address of the grantee, if applicable
    """

    access_level: str = pydantic.Field()
    """
    Granted access level: 'read', 'write', or 'admin'
    """

    granted_by: str = pydantic.Field()
    """
    ID of the user who created this grant
    """

    granted_by_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Display name of the user who created this grant
    """

    organization_id: str = pydantic.Field()
    """
    ID of the organization this grant belongs to
    """

    created_at: dt.datetime = pydantic.Field()
    """
    Timestamp when the grant was created
    """

    updated_at: dt.datetime = pydantic.Field()
    """
    Timestamp when the grant was last updated
    """

    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
