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

import enum
import typing

T_Result = typing.TypeVar("T_Result")


class Permissions(str, enum.Enum):
    ADMINISTRATOR = "administrator"
    VIEWER = "viewer"
    MEMBER = "member"
    ACCOUNT_MANAGER = "account-manager"
    CONNECT_UI = "connect-ui"
    TOKEN_ISSUER = "token-issuer"
    MCP_INTEGRATIONS_USE_ONLY = "mcp-integrations-use-only"
    """
    Permission set that provides the minimum level of access necessary for MCP use. Gives read access to accounts and integrations and the ability to use any Connector API.
    """

    MCP_MANAGEMENT = "mcp-management"
    """
    Permission set that provides the minimum level of access necessary for MCP management use. Can create and update integrations but cannot use any Connector API.
    """

    _UNKNOWN = "__PERMISSIONS_UNKNOWN__"
    """
    This member is used for forward compatibility. If the value is not recognized by the enum, it will be stored here, and the raw value is accessible through `.value`.
    """

    @classmethod
    def _missing_(cls, value: typing.Any) -> "Permissions":
        unknown = cls._UNKNOWN
        unknown._value_ = value
        return unknown

    def visit(
        self,
        administrator: typing.Callable[[], T_Result],
        viewer: typing.Callable[[], T_Result],
        member: typing.Callable[[], T_Result],
        account_manager: typing.Callable[[], T_Result],
        connect_ui: typing.Callable[[], T_Result],
        token_issuer: typing.Callable[[], T_Result],
        mcp_integrations_use_only: typing.Callable[[], T_Result],
        mcp_management: typing.Callable[[], T_Result],
        _unknown_member: typing.Callable[[str], T_Result],
    ) -> T_Result:
        if self is Permissions.ADMINISTRATOR:
            return administrator()
        if self is Permissions.VIEWER:
            return viewer()
        if self is Permissions.MEMBER:
            return member()
        if self is Permissions.ACCOUNT_MANAGER:
            return account_manager()
        if self is Permissions.CONNECT_UI:
            return connect_ui()
        if self is Permissions.TOKEN_ISSUER:
            return token_issuer()
        if self is Permissions.MCP_INTEGRATIONS_USE_ONLY:
            return mcp_integrations_use_only()
        if self is Permissions.MCP_MANAGEMENT:
            return mcp_management()
        return _unknown_member(self._value_)
