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

from angzarr_client.proto.angzarr import projector_pb2 as angzarr_dot_projector__pb2
from angzarr_client.proto.angzarr import types_pb2 as angzarr_dot_types__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class ProjectorServiceStub(object):
    """ProjectorService: client logic that projects events to read models
    client logic doesn't care about sync - coordinator decides
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Handle = channel.unary_unary(
                '/angzarr.ProjectorService/Handle',
                request_serializer=angzarr_dot_types__pb2.EventBook.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.Projection.FromString,
                _registered_method=True)
        self.HandleSpeculative = channel.unary_unary(
                '/angzarr.ProjectorService/HandleSpeculative',
                request_serializer=angzarr_dot_types__pb2.EventBook.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.Projection.FromString,
                _registered_method=True)


class ProjectorServiceServicer(object):
    """ProjectorService: client logic that projects events to read models
    client logic doesn't care about sync - coordinator decides
    """

    def Handle(self, request, context):
        """Async projection - projector should persist and return
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def HandleSpeculative(self, request, context):
        """Speculative processing - projector must avoid external side effects
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ProjectorServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Handle': grpc.unary_unary_rpc_method_handler(
                    servicer.Handle,
                    request_deserializer=angzarr_dot_types__pb2.EventBook.FromString,
                    response_serializer=angzarr_dot_types__pb2.Projection.SerializeToString,
            ),
            'HandleSpeculative': grpc.unary_unary_rpc_method_handler(
                    servicer.HandleSpeculative,
                    request_deserializer=angzarr_dot_types__pb2.EventBook.FromString,
                    response_serializer=angzarr_dot_types__pb2.Projection.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'angzarr.ProjectorService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('angzarr.ProjectorService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class ProjectorService(object):
    """ProjectorService: client logic that projects events to read models
    client logic doesn't care about sync - coordinator decides
    """

    @staticmethod
    def Handle(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,
            '/angzarr.ProjectorService/Handle',
            angzarr_dot_types__pb2.EventBook.SerializeToString,
            angzarr_dot_types__pb2.Projection.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def HandleSpeculative(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,
            '/angzarr.ProjectorService/HandleSpeculative',
            angzarr_dot_types__pb2.EventBook.SerializeToString,
            angzarr_dot_types__pb2.Projection.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)


class ProjectorCoordinatorServiceStub(object):
    """ProjectorCoordinatorService: orchestrates projection processing
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.HandleSync = channel.unary_unary(
                '/angzarr.ProjectorCoordinatorService/HandleSync',
                request_serializer=angzarr_dot_types__pb2.EventRequest.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.Projection.FromString,
                _registered_method=True)
        self.Handle = channel.unary_unary(
                '/angzarr.ProjectorCoordinatorService/Handle',
                request_serializer=angzarr_dot_types__pb2.EventBook.SerializeToString,
                response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                _registered_method=True)
        self.HandleSpeculative = channel.unary_unary(
                '/angzarr.ProjectorCoordinatorService/HandleSpeculative',
                request_serializer=angzarr_dot_projector__pb2.SpeculateProjectorRequest.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.Projection.FromString,
                _registered_method=True)


class ProjectorCoordinatorServiceServicer(object):
    """ProjectorCoordinatorService: orchestrates projection processing
    """

    def HandleSync(self, request, context):
        """Sync processing - returns projection based on sync_mode
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Handle(self, request, context):
        """Async processing - fire and forget
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def HandleSpeculative(self, request, context):
        """Speculative processing - returns projection without side effects
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ProjectorCoordinatorServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'HandleSync': grpc.unary_unary_rpc_method_handler(
                    servicer.HandleSync,
                    request_deserializer=angzarr_dot_types__pb2.EventRequest.FromString,
                    response_serializer=angzarr_dot_types__pb2.Projection.SerializeToString,
            ),
            'Handle': grpc.unary_unary_rpc_method_handler(
                    servicer.Handle,
                    request_deserializer=angzarr_dot_types__pb2.EventBook.FromString,
                    response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            ),
            'HandleSpeculative': grpc.unary_unary_rpc_method_handler(
                    servicer.HandleSpeculative,
                    request_deserializer=angzarr_dot_projector__pb2.SpeculateProjectorRequest.FromString,
                    response_serializer=angzarr_dot_types__pb2.Projection.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'angzarr.ProjectorCoordinatorService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('angzarr.ProjectorCoordinatorService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class ProjectorCoordinatorService(object):
    """ProjectorCoordinatorService: orchestrates projection processing
    """

    @staticmethod
    def HandleSync(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,
            '/angzarr.ProjectorCoordinatorService/HandleSync',
            angzarr_dot_types__pb2.EventRequest.SerializeToString,
            angzarr_dot_types__pb2.Projection.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Handle(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,
            '/angzarr.ProjectorCoordinatorService/Handle',
            angzarr_dot_types__pb2.EventBook.SerializeToString,
            google_dot_protobuf_dot_empty__pb2.Empty.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def HandleSpeculative(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,
            '/angzarr.ProjectorCoordinatorService/HandleSpeculative',
            angzarr_dot_projector__pb2.SpeculateProjectorRequest.SerializeToString,
            angzarr_dot_types__pb2.Projection.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
