# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from ai.stigmer.iam.iampolicy.v1 import api_pb2 as ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_api__pb2
from ai.stigmer.iam.iampolicy.v1 import io_pb2 as ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2


class IamPolicyQueryControllerStub(object):
    """iam-policy query controller
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.get = channel.unary_unary(
                '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/get',
                request_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.IamPolicyId.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_api__pb2.IamPolicy.FromString,
                _registered_method=True)
        self.checkAuthorization = channel.unary_unary(
                '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/checkAuthorization',
                request_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.CheckAuthorizationInput.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.CheckAuthorizationResult.FromString,
                _registered_method=True)
        self.listAuthorizedResourceIds = channel.unary_unary(
                '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/listAuthorizedResourceIds',
                request_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.ListAuthorizedResourceIdsInput.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.AuthorizedResourceIdsList.FromString,
                _registered_method=True)
        self.listAuthorizedPrincipalIds = channel.unary_unary(
                '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/listAuthorizedPrincipalIds',
                request_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.ListAuthorizedPrincipalIdsInput.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.AuthorizedPrincipalIdsList.FromString,
                _registered_method=True)


class IamPolicyQueryControllerServicer(object):
    """iam-policy query controller
    """

    def get(self, request, context):
        """lookup iam-policy by id
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def checkAuthorization(self, request, context):
        """Check if a principal is authorized to perform a relation on a resource

        This is the fundamental authorization check RPC that answers the question:
        "Does principal X have permission Y on resource Z?"

        It provides a simple boolean answer based on the complete authorization state,
        including existing IAM policies, inherited permissions, and group memberships.

        Use Cases:
        - Pre-flight UI checks before showing buttons/actions
        - API request authorization before processing operations
        - Service-to-service authorization
        - Team-based access checks

        Input: CheckAuthorizationInput with policy spec and optional contextual policies
        Output: CheckAuthorizationResult with is_authorized boolean
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def listAuthorizedResourceIds(self, request, context):
        """List all resource IDs of a specific kind that a principal is authorized to access

        This RPC answers: "What are all the [resource-kind] that [principal] can [relation] on?"
        Essential for building permission-aware UIs and filtering resource lists.

        Use Cases:
        - Resource list filtering in dropdowns
        - Permission-based navigation
        - Bulk authorization checks

        Input: ListAuthorizedResourceIdsInput with principal, resource_kind, and relation
        Output: AuthorizedResourceIdsList containing all accessible resource IDs
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def listAuthorizedPrincipalIds(self, request, context):
        """List all principal IDs of a specific kind that are authorized to access a resource

        This RPC answers: "What are all the [principal-kind] that have [relation] access on [resource]?"
        Inverse of listAuthorizedResourceIds.

        Use Cases:
        - Resource access audit (who can access this?)
        - Team discovery for resources
        - Compliance and security audits

        Input: ListAuthorizedPrincipalIdsInput with resource, principal_kind, and relation
        Output: AuthorizedPrincipalIdsList containing all authorized principal IDs
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_IamPolicyQueryControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'get': grpc.unary_unary_rpc_method_handler(
                    servicer.get,
                    request_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.IamPolicyId.FromString,
                    response_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_api__pb2.IamPolicy.SerializeToString,
            ),
            'checkAuthorization': grpc.unary_unary_rpc_method_handler(
                    servicer.checkAuthorization,
                    request_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.CheckAuthorizationInput.FromString,
                    response_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.CheckAuthorizationResult.SerializeToString,
            ),
            'listAuthorizedResourceIds': grpc.unary_unary_rpc_method_handler(
                    servicer.listAuthorizedResourceIds,
                    request_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.ListAuthorizedResourceIdsInput.FromString,
                    response_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.AuthorizedResourceIdsList.SerializeToString,
            ),
            'listAuthorizedPrincipalIds': grpc.unary_unary_rpc_method_handler(
                    servicer.listAuthorizedPrincipalIds,
                    request_deserializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.ListAuthorizedPrincipalIdsInput.FromString,
                    response_serializer=ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.AuthorizedPrincipalIdsList.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class IamPolicyQueryController(object):
    """iam-policy query controller
    """

    @staticmethod
    def get(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/get',
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.IamPolicyId.SerializeToString,
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_api__pb2.IamPolicy.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def checkAuthorization(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/checkAuthorization',
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.CheckAuthorizationInput.SerializeToString,
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.CheckAuthorizationResult.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def listAuthorizedResourceIds(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/listAuthorizedResourceIds',
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.ListAuthorizedResourceIdsInput.SerializeToString,
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.AuthorizedResourceIdsList.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def listAuthorizedPrincipalIds(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/ai.stigmer.iam.iampolicy.v1.IamPolicyQueryController/listAuthorizedPrincipalIds',
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.ListAuthorizedPrincipalIdsInput.SerializeToString,
            ai_dot_stigmer_dot_iam_dot_iampolicy_dot_v1_dot_io__pb2.AuthorizedPrincipalIdsList.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
