# 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 types_pb2 as angzarr_dot_types__pb2


class SagaServiceStub(object):
    """SagaService: client logic that coordinates across aggregates
    Two-phase protocol: Prepare (declare destinations) → Execute (with fetched state)
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetDescriptor = channel.unary_unary(
                '/angzarr.SagaService/GetDescriptor',
                request_serializer=angzarr_dot_types__pb2.GetDescriptorRequest.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.ComponentDescriptor.FromString,
                _registered_method=True)
        self.Prepare = channel.unary_unary(
                '/angzarr.SagaService/Prepare',
                request_serializer=angzarr_dot_types__pb2.SagaPrepareRequest.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.SagaPrepareResponse.FromString,
                _registered_method=True)
        self.Execute = channel.unary_unary(
                '/angzarr.SagaService/Execute',
                request_serializer=angzarr_dot_types__pb2.SagaExecuteRequest.SerializeToString,
                response_deserializer=angzarr_dot_types__pb2.SagaResponse.FromString,
                _registered_method=True)


class SagaServiceServicer(object):
    """SagaService: client logic that coordinates across aggregates
    Two-phase protocol: Prepare (declare destinations) → Execute (with fetched state)
    """

    def GetDescriptor(self, request, context):
        """Self-description: component type, subscribed domains, handled event types
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Prepare(self, request, context):
        """Phase 1: Saga declares which destination aggregates it needs
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Execute(self, request, context):
        """Phase 2: Execute with source + fetched destination state
        """
        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 = {
            'GetDescriptor': grpc.unary_unary_rpc_method_handler(
                    servicer.GetDescriptor,
                    request_deserializer=angzarr_dot_types__pb2.GetDescriptorRequest.FromString,
                    response_serializer=angzarr_dot_types__pb2.ComponentDescriptor.SerializeToString,
            ),
            'Prepare': grpc.unary_unary_rpc_method_handler(
                    servicer.Prepare,
                    request_deserializer=angzarr_dot_types__pb2.SagaPrepareRequest.FromString,
                    response_serializer=angzarr_dot_types__pb2.SagaPrepareResponse.SerializeToString,
            ),
            'Execute': grpc.unary_unary_rpc_method_handler(
                    servicer.Execute,
                    request_deserializer=angzarr_dot_types__pb2.SagaExecuteRequest.FromString,
                    response_serializer=angzarr_dot_types__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: client logic that coordinates across aggregates
    Two-phase protocol: Prepare (declare destinations) → Execute (with fetched state)
    """

    @staticmethod
    def GetDescriptor(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/GetDescriptor',
            angzarr_dot_types__pb2.GetDescriptorRequest.SerializeToString,
            angzarr_dot_types__pb2.ComponentDescriptor.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Prepare(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/Prepare',
            angzarr_dot_types__pb2.SagaPrepareRequest.SerializeToString,
            angzarr_dot_types__pb2.SagaPrepareResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @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.SagaService/Execute',
            angzarr_dot_types__pb2.SagaExecuteRequest.SerializeToString,
            angzarr_dot_types__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 across domains
    """

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

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


class SagaCoordinatorServiceServicer(object):
    """SagaCoordinatorService: orchestrates saga execution across domains
    """

    def ExecuteSpeculative(self, request, context):
        """Speculative execution - returns commands without executing them
        """
        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 = {
            'ExecuteSpeculative': grpc.unary_unary_rpc_method_handler(
                    servicer.ExecuteSpeculative,
                    request_deserializer=angzarr_dot_types__pb2.SagaExecuteRequest.FromString,
                    response_serializer=angzarr_dot_types__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 across domains
    """

    @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_types__pb2.SagaExecuteRequest.SerializeToString,
            angzarr_dot_types__pb2.SagaResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
