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

from cogment.api import common_pb2 as cogment_dot_api_dot_common__pb2
from cogment.api import directory_pb2 as cogment_dot_api_dot_directory__pb2


class DirectorySPStub(object):
    """Used for directory (service discovery) and first line load balancing.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Register = channel.stream_stream(
                '/cogmentAPI.DirectorySP/Register',
                request_serializer=cogment_dot_api_dot_directory__pb2.RegisterRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_directory__pb2.RegisterReply.FromString,
                )
        self.Deregister = channel.stream_stream(
                '/cogmentAPI.DirectorySP/Deregister',
                request_serializer=cogment_dot_api_dot_directory__pb2.DeregisterRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_directory__pb2.DeregisterReply.FromString,
                )
        self.Inquire = channel.unary_stream(
                '/cogmentAPI.DirectorySP/Inquire',
                request_serializer=cogment_dot_api_dot_directory__pb2.InquireRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_directory__pb2.InquireReply.FromString,
                )
        self.Version = channel.unary_unary(
                '/cogmentAPI.DirectorySP/Version',
                request_serializer=cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
                )


class DirectorySPServicer(object):
    """Used for directory (service discovery) and first line load balancing.
    """

    def Register(self, request_iterator, context):
        """Register as a service.
        - There will be a one-to-one match between requests and replies
        - Each request can succeed or fail individually
        Expected metadata:
        - authentication-token (may be optional, at the discretion of the implementation).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Deregister(self, request_iterator, context):
        """Deregister a service.
        - There will be a one-to-one match between requests and replies
        - Each request can succeed or fail individually
        Expected metadata:
        - authentication-token (required if it was used to register).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Inquire(self, request, context):
        """Inquire about registered services.
        Expected metadata:
        - authentication-token (may be optional, at the discretion of the implemetation).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Version(self, request, context):
        """Expected metadata: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_DirectorySPServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Register': grpc.stream_stream_rpc_method_handler(
                    servicer.Register,
                    request_deserializer=cogment_dot_api_dot_directory__pb2.RegisterRequest.FromString,
                    response_serializer=cogment_dot_api_dot_directory__pb2.RegisterReply.SerializeToString,
            ),
            'Deregister': grpc.stream_stream_rpc_method_handler(
                    servicer.Deregister,
                    request_deserializer=cogment_dot_api_dot_directory__pb2.DeregisterRequest.FromString,
                    response_serializer=cogment_dot_api_dot_directory__pb2.DeregisterReply.SerializeToString,
            ),
            'Inquire': grpc.unary_stream_rpc_method_handler(
                    servicer.Inquire,
                    request_deserializer=cogment_dot_api_dot_directory__pb2.InquireRequest.FromString,
                    response_serializer=cogment_dot_api_dot_directory__pb2.InquireReply.SerializeToString,
            ),
            'Version': grpc.unary_unary_rpc_method_handler(
                    servicer.Version,
                    request_deserializer=cogment_dot_api_dot_common__pb2.VersionRequest.FromString,
                    response_serializer=cogment_dot_api_dot_common__pb2.VersionInfo.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'cogmentAPI.DirectorySP', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class DirectorySP(object):
    """Used for directory (service discovery) and first line load balancing.
    """

    @staticmethod
    def Register(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/cogmentAPI.DirectorySP/Register',
            cogment_dot_api_dot_directory__pb2.RegisterRequest.SerializeToString,
            cogment_dot_api_dot_directory__pb2.RegisterReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Deregister(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(request_iterator, target, '/cogmentAPI.DirectorySP/Deregister',
            cogment_dot_api_dot_directory__pb2.DeregisterRequest.SerializeToString,
            cogment_dot_api_dot_directory__pb2.DeregisterReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Inquire(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_stream(request, target, '/cogmentAPI.DirectorySP/Inquire',
            cogment_dot_api_dot_directory__pb2.InquireRequest.SerializeToString,
            cogment_dot_api_dot_directory__pb2.InquireReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Version(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, '/cogmentAPI.DirectorySP/Version',
            cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
            cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
