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

from meshtrade.ledger.transaction.v1 import service_pb2 as meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2


class TransactionServiceStub(object):
    """
    TransactionService manages Transaction lifecycle.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetTransactionState = channel.unary_unary(
                '/meshtrade.ledger.transaction.v1.TransactionService/GetTransactionState',
                request_serializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.GetTransactionStateRequest.SerializeToString,
                response_deserializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.GetTransactionStateResponse.FromString,
                _registered_method=True)
        self.MonitorTransactionState = channel.unary_stream(
                '/meshtrade.ledger.transaction.v1.TransactionService/MonitorTransactionState',
                request_serializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.MonitorTransactionStateRequest.SerializeToString,
                response_deserializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.MonitorTransactionStateResponse.FromString,
                _registered_method=True)


class TransactionServiceServicer(object):
    """
    TransactionService manages Transaction lifecycle.
    """

    def GetTransactionState(self, request, context):
        """
        Retrieves a single Transaction state by the unique identifier of the transaction
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def MonitorTransactionState(self, request, context):
        """
        Monitor Transaction state changes by the unique identifier of the transaction.
        Server-side streaming method that sends state updates as the transaction progresses.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TransactionServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetTransactionState': grpc.unary_unary_rpc_method_handler(
                    servicer.GetTransactionState,
                    request_deserializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.GetTransactionStateRequest.FromString,
                    response_serializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.GetTransactionStateResponse.SerializeToString,
            ),
            'MonitorTransactionState': grpc.unary_stream_rpc_method_handler(
                    servicer.MonitorTransactionState,
                    request_deserializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.MonitorTransactionStateRequest.FromString,
                    response_serializer=meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.MonitorTransactionStateResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'meshtrade.ledger.transaction.v1.TransactionService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('meshtrade.ledger.transaction.v1.TransactionService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class TransactionService(object):
    """
    TransactionService manages Transaction lifecycle.
    """

    @staticmethod
    def GetTransactionState(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.ledger.transaction.v1.TransactionService/GetTransactionState',
            meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.GetTransactionStateRequest.SerializeToString,
            meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.GetTransactionStateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def MonitorTransactionState(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,
            '/meshtrade.ledger.transaction.v1.TransactionService/MonitorTransactionState',
            meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.MonitorTransactionStateRequest.SerializeToString,
            meshtrade_dot_ledger_dot_transaction_dot_v1_dot_service__pb2.MonitorTransactionStateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
