# 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 .resource_access_info_access_source import ResourceAccessInfoAccessSource
from .resource_access_info_anonymous_access_level_override import ResourceAccessInfoAnonymousAccessLevelOverride
from .resource_access_info_role import ResourceAccessInfoRole


class ResourceAccessInfo(UncheckedBaseModel):
    is_creator: bool = pydantic.Field()
    """
    Whether the user making the request is the creator of the agent
    """

    creator_name: str = pydantic.Field()
    """
    Name of the agent's creator
    """

    creator_email: str = pydantic.Field()
    """
    Email of the agent's creator
    """

    role: ResourceAccessInfoRole = pydantic.Field()
    """
    The role of the user making the request
    """

    anonymous_access_level_override: typing.Optional[ResourceAccessInfoAnonymousAccessLevelOverride] = pydantic.Field(
        default=None
    )
    """
    The access level for anonymous users. If None, the resource is not shared publicly.
    """

    access_source: typing.Optional[ResourceAccessInfoAccessSource] = pydantic.Field(default=None)
    """
    Why the requesting user has access to this resource. 'creator' = caller is the owner. 'explicit' = caller (or one of their workspace groups) is listed in role_to_group_ids beyond the workspace-wide everyone group. 'workspace_default' = the workspace-wide everyone group is listed in role_to_group_ids (every non-anon workspace member, including admins, sees this resource). 'workspace_admin' = caller is a workspace admin and the admin seat is the *only* path to access; reserved for docs nobody else can see. Lets the UI disclose why an admin-bypass viewer sees a doc that wasn't explicitly shared with them.
    """

    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
