# 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.commons.apiresource import io_pb2 as ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2
from ai.stigmer.tenancy.organization.v1 import api_pb2 as ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2
from ai.stigmer.tenancy.organization.v1 import io_pb2 as ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class OrganizationQueryControllerStub(object):
    """OrganizationQueryController provides read operations for organizations
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.get = channel.unary_unary(
                '/ai.stigmer.tenancy.organization.v1.OrganizationQueryController/get',
                request_serializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationId.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2.Organization.FromString,
                _registered_method=True)
        self.find = channel.unary_unary(
                '/ai.stigmer.tenancy.organization.v1.OrganizationQueryController/find',
                request_serializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.FindApiResourcesRequest.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationList.FromString,
                _registered_method=True)
        self.findMyOrganizations = channel.unary_unary(
                '/ai.stigmer.tenancy.organization.v1.OrganizationQueryController/findMyOrganizations',
                request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.Organizations.FromString,
                _registered_method=True)
        self.getByExternalOrgId = channel.unary_unary(
                '/ai.stigmer.tenancy.organization.v1.OrganizationQueryController/getByExternalOrgId',
                request_serializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationExternalLookup.SerializeToString,
                response_deserializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2.Organization.FromString,
                _registered_method=True)


class OrganizationQueryControllerServicer(object):
    """OrganizationQueryController provides read operations for organizations
    """

    def get(self, request, context):
        """Get an organization by ID
        Requires: User must be a member of the organization (can_view)
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def find(self, request, context):
        """Find organizations with pagination and filtering
        Requires: Platform admin permission
        This is for administrative purposes only
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def findMyOrganizations(self, request, context):
        """Find organizations the authenticated user is a member of
        Authorization handled in handler via IAM Policy listAuthorizedResourceIds
        Returns only organizations the caller has access to
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getByExternalOrgId(self, request, context):
        """Look up a platform-managed organization by its external platform coordinates.
        Returns the Stigmer organization mapped to the given IdentityProvider + external org ID.
        Authorization: custom — checks can_view on the referenced IdentityProvider.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_OrganizationQueryControllerServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'get': grpc.unary_unary_rpc_method_handler(
                    servicer.get,
                    request_deserializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationId.FromString,
                    response_serializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2.Organization.SerializeToString,
            ),
            'find': grpc.unary_unary_rpc_method_handler(
                    servicer.find,
                    request_deserializer=ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.FindApiResourcesRequest.FromString,
                    response_serializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationList.SerializeToString,
            ),
            'findMyOrganizations': grpc.unary_unary_rpc_method_handler(
                    servicer.findMyOrganizations,
                    request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                    response_serializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.Organizations.SerializeToString,
            ),
            'getByExternalOrgId': grpc.unary_unary_rpc_method_handler(
                    servicer.getByExternalOrgId,
                    request_deserializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationExternalLookup.FromString,
                    response_serializer=ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2.Organization.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ai.stigmer.tenancy.organization.v1.OrganizationQueryController', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('ai.stigmer.tenancy.organization.v1.OrganizationQueryController', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class OrganizationQueryController(object):
    """OrganizationQueryController provides read operations for organizations
    """

    @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.tenancy.organization.v1.OrganizationQueryController/get',
            ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationId.SerializeToString,
            ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2.Organization.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def find(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.tenancy.organization.v1.OrganizationQueryController/find',
            ai_dot_stigmer_dot_commons_dot_apiresource_dot_io__pb2.FindApiResourcesRequest.SerializeToString,
            ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationList.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def findMyOrganizations(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.tenancy.organization.v1.OrganizationQueryController/findMyOrganizations',
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.Organizations.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def getByExternalOrgId(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.tenancy.organization.v1.OrganizationQueryController/getByExternalOrgId',
            ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_io__pb2.OrganizationExternalLookup.SerializeToString,
            ai_dot_stigmer_dot_tenancy_dot_organization_dot_v1_dot_api__pb2.Organization.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
