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

from meshtrade.iam.user.v1 import service_pb2 as meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2
from meshtrade.iam.user.v1 import user_pb2 as meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2


class UserServiceStub(object):
    """
    UserService manages user lifecycle and identity operations within groups.

    Users are individual identity entities that belong to specific groups and have
    assigned roles that determine their permissions within that group context.
    Each user has a unique email address and can be assigned multiple roles
    across the group hierarchy for fine-grained access control.

    All operations require appropriate IAM domain permissions and operate within
    the authenticated group context.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.AssignRolesToUser = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/AssignRolesToUser',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.AssignRolesToUserRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
                _registered_method=True)
        self.RevokeRolesFromUser = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/RevokeRolesFromUser',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.RevokeRolesFromUserRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
                _registered_method=True)
        self.GetUser = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/GetUser',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.GetUserRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
                _registered_method=True)
        self.ListUsers = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/ListUsers',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.ListUsersRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.ListUsersResponse.FromString,
                _registered_method=True)
        self.SearchUsers = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/SearchUsers',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.SearchUsersRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.SearchUsersResponse.FromString,
                _registered_method=True)
        self.CreateUser = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/CreateUser',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.CreateUserRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
                _registered_method=True)
        self.UpdateUser = channel.unary_unary(
                '/meshtrade.iam.user.v1.UserService/UpdateUser',
                request_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.UpdateUserRequest.SerializeToString,
                response_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
                _registered_method=True)


class UserServiceServicer(object):
    """
    UserService manages user lifecycle and identity operations within groups.

    Users are individual identity entities that belong to specific groups and have
    assigned roles that determine their permissions within that group context.
    Each user has a unique email address and can be assigned multiple roles
    across the group hierarchy for fine-grained access control.

    All operations require appropriate IAM domain permissions and operate within
    the authenticated group context.
    """

    def AssignRolesToUser(self, request, context):
        """
        Assign roles to an existing user within the authenticated group context.

        The role assignment enables the user to perform operations according
        to the permissions associated with that role within the group hierarchy.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RevokeRolesFromUser(self, request, context):
        """
        Revoke roles from an existing user within the authenticated group context.

        The role revocation removes the permissions associated with that role from
        the user within the group hierarchy. The user will no longer be able
        to perform operations that require the revoked role.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetUser(self, request, context):
        """
        Retrieves a single user by its unique identifier.

        Returns user details including name, email, ownership information,
        and assigned roles within the authenticated group's access scope.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListUsers(self, request, context):
        """
        Returns all users accessible within the authenticated group's hierarchy.

        Results include users directly owned and those accessible through the
        group's hierarchical permissions, optionally sorted by email address.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SearchUsers(self, request, context):
        """
        Searches for users by email address using substring matching.

        Returns users whose email addresses contain the provided search term,
        filtered by the authenticated group's access permissions and optionally
        sorted by email address.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CreateUser(self, request, context):
        """
        Creates a new user within the authenticated group context.

        The user will be created with the provided email and group ownership,
        with system-generated unique identifier and ownership hierarchy.
        Additional roles can be assigned after creation.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UpdateUser(self, request, context):
        """
        Updates an existing user with modified field values.

        Only mutable fields can be updated while preserving system-generated
        identifiers and ownership relationships. Role modifications should
        use dedicated role management operations.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_UserServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'AssignRolesToUser': grpc.unary_unary_rpc_method_handler(
                    servicer.AssignRolesToUser,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.AssignRolesToUserRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.SerializeToString,
            ),
            'RevokeRolesFromUser': grpc.unary_unary_rpc_method_handler(
                    servicer.RevokeRolesFromUser,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.RevokeRolesFromUserRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.SerializeToString,
            ),
            'GetUser': grpc.unary_unary_rpc_method_handler(
                    servicer.GetUser,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.GetUserRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.SerializeToString,
            ),
            'ListUsers': grpc.unary_unary_rpc_method_handler(
                    servicer.ListUsers,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.ListUsersRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.ListUsersResponse.SerializeToString,
            ),
            'SearchUsers': grpc.unary_unary_rpc_method_handler(
                    servicer.SearchUsers,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.SearchUsersRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.SearchUsersResponse.SerializeToString,
            ),
            'CreateUser': grpc.unary_unary_rpc_method_handler(
                    servicer.CreateUser,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.CreateUserRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.SerializeToString,
            ),
            'UpdateUser': grpc.unary_unary_rpc_method_handler(
                    servicer.UpdateUser,
                    request_deserializer=meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.UpdateUserRequest.FromString,
                    response_serializer=meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'meshtrade.iam.user.v1.UserService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('meshtrade.iam.user.v1.UserService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class UserService(object):
    """
    UserService manages user lifecycle and identity operations within groups.

    Users are individual identity entities that belong to specific groups and have
    assigned roles that determine their permissions within that group context.
    Each user has a unique email address and can be assigned multiple roles
    across the group hierarchy for fine-grained access control.

    All operations require appropriate IAM domain permissions and operate within
    the authenticated group context.
    """

    @staticmethod
    def AssignRolesToUser(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,
            '/meshtrade.iam.user.v1.UserService/AssignRolesToUser',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.AssignRolesToUserRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RevokeRolesFromUser(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,
            '/meshtrade.iam.user.v1.UserService/RevokeRolesFromUser',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.RevokeRolesFromUserRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetUser(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,
            '/meshtrade.iam.user.v1.UserService/GetUser',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.GetUserRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListUsers(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,
            '/meshtrade.iam.user.v1.UserService/ListUsers',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.ListUsersRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.ListUsersResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SearchUsers(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,
            '/meshtrade.iam.user.v1.UserService/SearchUsers',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.SearchUsersRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.SearchUsersResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CreateUser(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,
            '/meshtrade.iam.user.v1.UserService/CreateUser',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.CreateUserRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def UpdateUser(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,
            '/meshtrade.iam.user.v1.UserService/UpdateUser',
            meshtrade_dot_iam_dot_user_dot_v1_dot_service__pb2.UpdateUserRequest.SerializeToString,
            meshtrade_dot_iam_dot_user_dot_v1_dot_user__pb2.User.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
