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

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.authorized_operation_type import AuthorizedOperationType
from ..types.authz_search_response import AuthzSearchResponse
from ..types.principal_request import PrincipalRequest
from ..types.revoke_all_response import RevokeAllResponse
from ..types.terminal_use_resource import TerminalUseResource
from ..types.terminal_use_resource_type import TerminalUseResourceType
from .raw_client import AsyncRawAuthorizationInternalClient, RawAuthorizationInternalClient

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class AuthorizationInternalClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAuthorizationInternalClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawAuthorizationInternalClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAuthorizationInternalClient
        """
        return self._raw_client

    def check_permission(
        self,
        *,
        operation: AuthorizedOperationType,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Check if a principal has permission to perform an operation on a resource.

        Parameters
        ----------
        operation : AuthorizedOperationType

        principal : PrincipalRequest

        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import PrincipalRequest, TerminalUseBase, TerminalUseResource

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.check_permission(
            operation="create",
            principal=PrincipalRequest(
                member_id="member_id",
            ),
            resource=TerminalUseResource(
                selector="selector",
                type="member",
            ),
        )
        """
        _response = self._raw_client.check_permission(
            operation=operation, principal=principal, resource=resource, request_options=request_options
        )
        return _response.data

    def grant_permission(
        self,
        *,
        operation: AuthorizedOperationType,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Grant a permission to a principal for a resource.

        Parameters
        ----------
        operation : AuthorizedOperationType

        principal : PrincipalRequest

        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import PrincipalRequest, TerminalUseBase, TerminalUseResource

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.grant_permission(
            operation="create",
            principal=PrincipalRequest(
                member_id="member_id",
            ),
            resource=TerminalUseResource(
                selector="selector",
                type="member",
            ),
        )
        """
        _response = self._raw_client.grant_permission(
            operation=operation, principal=principal, resource=resource, request_options=request_options
        )
        return _response.data

    def revoke_permission(
        self,
        *,
        operation: AuthorizedOperationType,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Revoke a permission from a principal for a resource.

        Parameters
        ----------
        operation : AuthorizedOperationType

        principal : PrincipalRequest

        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import PrincipalRequest, TerminalUseBase, TerminalUseResource

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.revoke_permission(
            operation="create",
            principal=PrincipalRequest(
                member_id="member_id",
            ),
            resource=TerminalUseResource(
                selector="selector",
                type="member",
            ),
        )
        """
        _response = self._raw_client.revoke_permission(
            operation=operation, principal=principal, resource=resource, request_options=request_options
        )
        return _response.data

    def revoke_all_for_resource(
        self, *, resource: TerminalUseResource, request_options: typing.Optional[RequestOptions] = None
    ) -> RevokeAllResponse:
        """
        Revoke all permission tuples for a resource (used during deletion).

        Parameters
        ----------
        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        RevokeAllResponse
            Successful Response

        Examples
        --------
        from terminaluse import TerminalUseBase, TerminalUseResource

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.revoke_all_for_resource(
            resource=TerminalUseResource(
                selector="selector",
                type="member",
            ),
        )
        """
        _response = self._raw_client.revoke_all_for_resource(resource=resource, request_options=request_options)
        return _response.data

    def search_resources(
        self,
        *,
        filter_resource: TerminalUseResourceType,
        principal: PrincipalRequest,
        filter_operation: typing.Optional[AuthorizedOperationType] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AuthzSearchResponse:
        """
        List resource IDs that a principal can access.

        Parameters
        ----------
        filter_resource : TerminalUseResourceType
            Type of resource to search for

        principal : PrincipalRequest

        filter_operation : typing.Optional[AuthorizedOperationType]
            Operation to filter by

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AuthzSearchResponse
            Successful Response

        Examples
        --------
        from terminaluse import PrincipalRequest, TerminalUseBase

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.search_resources(
            filter_resource="member",
            principal=PrincipalRequest(
                member_id="member_id",
            ),
        )
        """
        _response = self._raw_client.search_resources(
            filter_resource=filter_resource,
            principal=principal,
            filter_operation=filter_operation,
            request_options=request_options,
        )
        return _response.data

    def write_membership_tuple(
        self,
        *,
        member_id: str,
        org_id: str,
        relation: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Write an organization membership tuple.

        Parameters
        ----------
        member_id : str
            Member ID

        org_id : str
            Organization ID

        relation : typing.Optional[str]
            Relation name

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import TerminalUseBase

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.write_membership_tuple(
            member_id="member_id",
            org_id="org_id",
        )
        """
        _response = self._raw_client.write_membership_tuple(
            member_id=member_id, org_id=org_id, relation=relation, request_options=request_options
        )
        return _response.data

    def delete_membership_tuple(
        self,
        *,
        member_id: str,
        org_id: str,
        relation: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Delete an organization membership tuple.

        Parameters
        ----------
        member_id : str
            Member ID

        org_id : str
            Organization ID

        relation : typing.Optional[str]
            Relation name

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import TerminalUseBase

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.delete_membership_tuple(
            member_id="member_id",
            org_id="org_id",
        )
        """
        _response = self._raw_client.delete_membership_tuple(
            member_id=member_id, org_id=org_id, relation=relation, request_options=request_options
        )
        return _response.data

    def write_parent_tuple(
        self,
        *,
        child_id: str,
        child_type: TerminalUseResourceType,
        parent_id: str,
        parent_type: TerminalUseResourceType,
        relation: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Write a parent relationship tuple to establish resource hierarchy.

        Parameters
        ----------
        child_id : str
            ID of child resource

        child_type : TerminalUseResourceType
            Type of child resource

        parent_id : str
            ID of parent resource

        parent_type : TerminalUseResourceType
            Type of parent resource

        relation : typing.Optional[str]
            Relation name

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import TerminalUseBase

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.write_parent_tuple(
            child_id="child_id",
            child_type="member",
            parent_id="parent_id",
            parent_type="member",
        )
        """
        _response = self._raw_client.write_parent_tuple(
            child_id=child_id,
            child_type=child_type,
            parent_id=parent_id,
            parent_type=parent_type,
            relation=relation,
            request_options=request_options,
        )
        return _response.data

    def write_role_tuple(
        self,
        *,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        role: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Write a role tuple to grant a role on a resource.

        Parameters
        ----------
        principal : PrincipalRequest

        resource : TerminalUseResource

        role : str
            Role name (viewer, editor, admin, owner)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import PrincipalRequest, TerminalUseBase, TerminalUseResource

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.write_role_tuple(
            principal=PrincipalRequest(
                member_id="member_id",
            ),
            resource=TerminalUseResource(
                selector="selector",
                type="member",
            ),
            role="role",
        )
        """
        _response = self._raw_client.write_role_tuple(
            principal=principal, resource=resource, role=role, request_options=request_options
        )
        return _response.data

    def delete_role_tuple(
        self,
        *,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        role: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Delete a role tuple to revoke a role on a resource.

        Parameters
        ----------
        principal : PrincipalRequest

        resource : TerminalUseResource

        role : str
            Role name (viewer, editor, admin, owner)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        from terminaluse import PrincipalRequest, TerminalUseBase, TerminalUseResource

        client = TerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )
        client.authorization_internal.delete_role_tuple(
            principal=PrincipalRequest(
                member_id="member_id",
            ),
            resource=TerminalUseResource(
                selector="selector",
                type="member",
            ),
            role="role",
        )
        """
        _response = self._raw_client.delete_role_tuple(
            principal=principal, resource=resource, role=role, request_options=request_options
        )
        return _response.data


class AsyncAuthorizationInternalClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAuthorizationInternalClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawAuthorizationInternalClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAuthorizationInternalClient
        """
        return self._raw_client

    async def check_permission(
        self,
        *,
        operation: AuthorizedOperationType,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Check if a principal has permission to perform an operation on a resource.

        Parameters
        ----------
        operation : AuthorizedOperationType

        principal : PrincipalRequest

        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import (
            AsyncTerminalUseBase,
            PrincipalRequest,
            TerminalUseResource,
        )

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.check_permission(
                operation="create",
                principal=PrincipalRequest(
                    member_id="member_id",
                ),
                resource=TerminalUseResource(
                    selector="selector",
                    type="member",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.check_permission(
            operation=operation, principal=principal, resource=resource, request_options=request_options
        )
        return _response.data

    async def grant_permission(
        self,
        *,
        operation: AuthorizedOperationType,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Grant a permission to a principal for a resource.

        Parameters
        ----------
        operation : AuthorizedOperationType

        principal : PrincipalRequest

        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import (
            AsyncTerminalUseBase,
            PrincipalRequest,
            TerminalUseResource,
        )

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.grant_permission(
                operation="create",
                principal=PrincipalRequest(
                    member_id="member_id",
                ),
                resource=TerminalUseResource(
                    selector="selector",
                    type="member",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.grant_permission(
            operation=operation, principal=principal, resource=resource, request_options=request_options
        )
        return _response.data

    async def revoke_permission(
        self,
        *,
        operation: AuthorizedOperationType,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Revoke a permission from a principal for a resource.

        Parameters
        ----------
        operation : AuthorizedOperationType

        principal : PrincipalRequest

        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import (
            AsyncTerminalUseBase,
            PrincipalRequest,
            TerminalUseResource,
        )

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.revoke_permission(
                operation="create",
                principal=PrincipalRequest(
                    member_id="member_id",
                ),
                resource=TerminalUseResource(
                    selector="selector",
                    type="member",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.revoke_permission(
            operation=operation, principal=principal, resource=resource, request_options=request_options
        )
        return _response.data

    async def revoke_all_for_resource(
        self, *, resource: TerminalUseResource, request_options: typing.Optional[RequestOptions] = None
    ) -> RevokeAllResponse:
        """
        Revoke all permission tuples for a resource (used during deletion).

        Parameters
        ----------
        resource : TerminalUseResource

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        RevokeAllResponse
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import AsyncTerminalUseBase, TerminalUseResource

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.revoke_all_for_resource(
                resource=TerminalUseResource(
                    selector="selector",
                    type="member",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.revoke_all_for_resource(resource=resource, request_options=request_options)
        return _response.data

    async def search_resources(
        self,
        *,
        filter_resource: TerminalUseResourceType,
        principal: PrincipalRequest,
        filter_operation: typing.Optional[AuthorizedOperationType] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AuthzSearchResponse:
        """
        List resource IDs that a principal can access.

        Parameters
        ----------
        filter_resource : TerminalUseResourceType
            Type of resource to search for

        principal : PrincipalRequest

        filter_operation : typing.Optional[AuthorizedOperationType]
            Operation to filter by

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AuthzSearchResponse
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import AsyncTerminalUseBase, PrincipalRequest

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.search_resources(
                filter_resource="member",
                principal=PrincipalRequest(
                    member_id="member_id",
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.search_resources(
            filter_resource=filter_resource,
            principal=principal,
            filter_operation=filter_operation,
            request_options=request_options,
        )
        return _response.data

    async def write_membership_tuple(
        self,
        *,
        member_id: str,
        org_id: str,
        relation: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Write an organization membership tuple.

        Parameters
        ----------
        member_id : str
            Member ID

        org_id : str
            Organization ID

        relation : typing.Optional[str]
            Relation name

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import AsyncTerminalUseBase

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.write_membership_tuple(
                member_id="member_id",
                org_id="org_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.write_membership_tuple(
            member_id=member_id, org_id=org_id, relation=relation, request_options=request_options
        )
        return _response.data

    async def delete_membership_tuple(
        self,
        *,
        member_id: str,
        org_id: str,
        relation: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Delete an organization membership tuple.

        Parameters
        ----------
        member_id : str
            Member ID

        org_id : str
            Organization ID

        relation : typing.Optional[str]
            Relation name

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import AsyncTerminalUseBase

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.delete_membership_tuple(
                member_id="member_id",
                org_id="org_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_membership_tuple(
            member_id=member_id, org_id=org_id, relation=relation, request_options=request_options
        )
        return _response.data

    async def write_parent_tuple(
        self,
        *,
        child_id: str,
        child_type: TerminalUseResourceType,
        parent_id: str,
        parent_type: TerminalUseResourceType,
        relation: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Write a parent relationship tuple to establish resource hierarchy.

        Parameters
        ----------
        child_id : str
            ID of child resource

        child_type : TerminalUseResourceType
            Type of child resource

        parent_id : str
            ID of parent resource

        parent_type : TerminalUseResourceType
            Type of parent resource

        relation : typing.Optional[str]
            Relation name

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import AsyncTerminalUseBase

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.write_parent_tuple(
                child_id="child_id",
                child_type="member",
                parent_id="parent_id",
                parent_type="member",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.write_parent_tuple(
            child_id=child_id,
            child_type=child_type,
            parent_id=parent_id,
            parent_type=parent_type,
            relation=relation,
            request_options=request_options,
        )
        return _response.data

    async def write_role_tuple(
        self,
        *,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        role: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Write a role tuple to grant a role on a resource.

        Parameters
        ----------
        principal : PrincipalRequest

        resource : TerminalUseResource

        role : str
            Role name (viewer, editor, admin, owner)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import (
            AsyncTerminalUseBase,
            PrincipalRequest,
            TerminalUseResource,
        )

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.write_role_tuple(
                principal=PrincipalRequest(
                    member_id="member_id",
                ),
                resource=TerminalUseResource(
                    selector="selector",
                    type="member",
                ),
                role="role",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.write_role_tuple(
            principal=principal, resource=resource, role=role, request_options=request_options
        )
        return _response.data

    async def delete_role_tuple(
        self,
        *,
        principal: PrincipalRequest,
        resource: TerminalUseResource,
        role: str,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Dict[str, typing.Any]:
        """
        Delete a role tuple to revoke a role on a resource.

        Parameters
        ----------
        principal : PrincipalRequest

        resource : TerminalUseResource

        role : str
            Role name (viewer, editor, admin, owner)

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from terminaluse import (
            AsyncTerminalUseBase,
            PrincipalRequest,
            TerminalUseResource,
        )

        client = AsyncTerminalUseBase(
            agent_api_key="YOUR_AGENT_API_KEY",
            token="YOUR_TOKEN",
            base_url="https://yourhost.com/path/to/api",
        )


        async def main() -> None:
            await client.authorization_internal.delete_role_tuple(
                principal=PrincipalRequest(
                    member_id="member_id",
                ),
                resource=TerminalUseResource(
                    selector="selector",
                    type="member",
                ),
                role="role",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete_role_tuple(
            principal=principal, resource=resource, role=role, request_options=request_options
        )
        return _response.data
