# 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 saga_pb2 as angzarr_dot_saga__pb2


class SagaServiceStub(object):
    """SagaService: stateless translation from source events to commands.
    Sagas receive only source events — framework handles sequence stamping and delivery.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Handle = channel.unary_unary(
                '/angzarr.SagaService/Handle',
                request_serializer=angzarr_dot_saga__pb2.SagaHandleRequest.SerializeToString,
                response_deserializer=angzarr_dot_saga__pb2.SagaResponse.FromString,
                _registered_method=True)


class SagaServiceServicer(object):
    """SagaService: stateless translation from source events to commands.
    Sagas receive only source events — framework handles sequence stamping and delivery.
    """

    def Handle(self, request, context):
        """Translate source events into commands for target domains.
        Commands use angzarr_deferred — framework stamps explicit sequences on delivery.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SagaServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Handle': grpc.unary_unary_rpc_method_handler(
                    servicer.Handle,
                    request_deserializer=angzarr_dot_saga__pb2.SagaHandleRequest.FromString,
                    response_serializer=angzarr_dot_saga__pb2.SagaResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'angzarr.SagaService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('angzarr.SagaService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class SagaService(object):
    """SagaService: stateless translation from source events to commands.
    Sagas receive only source events — framework handles sequence stamping and delivery.
    """

    @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.SagaService/Handle',
            angzarr_dot_saga__pb2.SagaHandleRequest.SerializeToString,
            angzarr_dot_saga__pb2.SagaResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)


class SagaCoordinatorServiceStub(object):
    """SagaCoordinatorService: orchestrates saga execution.
    Framework handles sequence stamping and delivery retry.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Execute = channel.unary_unary(
                '/angzarr.SagaCoordinatorService/Execute',
                request_serializer=angzarr_dot_saga__pb2.SagaHandleRequest.SerializeToString,
                response_deserializer=angzarr_dot_saga__pb2.SagaResponse.FromString,
                _registered_method=True)
        self.ExecuteSpeculative = channel.unary_unary(
                '/angzarr.SagaCoordinatorService/ExecuteSpeculative',
                request_serializer=angzarr_dot_saga__pb2.SpeculateSagaRequest.SerializeToString,
                response_deserializer=angzarr_dot_saga__pb2.SagaResponse.FromString,
                _registered_method=True)


class SagaCoordinatorServiceServicer(object):
    """SagaCoordinatorService: orchestrates saga execution.
    Framework handles sequence stamping and delivery retry.
    """

    def Execute(self, request, context):
        """Execute saga: translate source events → commands, deliver to targets
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

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


def add_SagaCoordinatorServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Execute': grpc.unary_unary_rpc_method_handler(
                    servicer.Execute,
                    request_deserializer=angzarr_dot_saga__pb2.SagaHandleRequest.FromString,
                    response_serializer=angzarr_dot_saga__pb2.SagaResponse.SerializeToString,
            ),
            'ExecuteSpeculative': grpc.unary_unary_rpc_method_handler(
                    servicer.ExecuteSpeculative,
                    request_deserializer=angzarr_dot_saga__pb2.SpeculateSagaRequest.FromString,
                    response_serializer=angzarr_dot_saga__pb2.SagaResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'angzarr.SagaCoordinatorService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('angzarr.SagaCoordinatorService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class SagaCoordinatorService(object):
    """SagaCoordinatorService: orchestrates saga execution.
    Framework handles sequence stamping and delivery retry.
    """

    @staticmethod
    def Execute(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.SagaCoordinatorService/Execute',
            angzarr_dot_saga__pb2.SagaHandleRequest.SerializeToString,
            angzarr_dot_saga__pb2.SagaResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ExecuteSpeculative(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.SagaCoordinatorService/ExecuteSpeculative',
            angzarr_dot_saga__pb2.SpeculateSagaRequest.SerializeToString,
            angzarr_dot_saga__pb2.SagaResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
