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

from . import exchange_pb2 as exchange__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2

GRPC_GENERATED_VERSION = '1.71.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in exchange_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class ExchangeStub(object):
    """The exchange service definition.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.SubmitOrder = channel.unary_unary(
                '/exchange.Exchange/SubmitOrder',
                request_serializer=exchange__pb2.OrderRequest.SerializeToString,
                response_deserializer=exchange__pb2.GenericResponse.FromString,
                _registered_method=True)
        self.CancelOrder = channel.unary_unary(
                '/exchange.Exchange/CancelOrder',
                request_serializer=exchange__pb2.CancelOrderRequest.SerializeToString,
                response_deserializer=exchange__pb2.GenericResponse.FromString,
                _registered_method=True)
        self.CancelOrders = channel.unary_unary(
                '/exchange.Exchange/CancelOrders',
                request_serializer=exchange__pb2.CancelOrdersRequest.SerializeToString,
                response_deserializer=exchange__pb2.GenericResponseList.FromString,
                _registered_method=True)
        self.GetPositions = channel.unary_unary(
                '/exchange.Exchange/GetPositions',
                request_serializer=exchange__pb2.GetPositionsRequest.SerializeToString,
                response_deserializer=exchange__pb2.PositionStatus.FromString,
                _registered_method=True)
        self.GetExchangeStatus = channel.unary_unary(
                '/exchange.Exchange/GetExchangeStatus',
                request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
                response_deserializer=exchange__pb2.GenericResponse.FromString,
                _registered_method=True)


class ExchangeServicer(object):
    """The exchange service definition.
    """

    def SubmitOrder(self, request, context):
        """Submit a new order.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CancelOrder(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CancelOrders(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetPositions(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetExchangeStatus(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ExchangeServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'SubmitOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.SubmitOrder,
                    request_deserializer=exchange__pb2.OrderRequest.FromString,
                    response_serializer=exchange__pb2.GenericResponse.SerializeToString,
            ),
            'CancelOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.CancelOrder,
                    request_deserializer=exchange__pb2.CancelOrderRequest.FromString,
                    response_serializer=exchange__pb2.GenericResponse.SerializeToString,
            ),
            'CancelOrders': grpc.unary_unary_rpc_method_handler(
                    servicer.CancelOrders,
                    request_deserializer=exchange__pb2.CancelOrdersRequest.FromString,
                    response_serializer=exchange__pb2.GenericResponseList.SerializeToString,
            ),
            'GetPositions': grpc.unary_unary_rpc_method_handler(
                    servicer.GetPositions,
                    request_deserializer=exchange__pb2.GetPositionsRequest.FromString,
                    response_serializer=exchange__pb2.PositionStatus.SerializeToString,
            ),
            'GetExchangeStatus': grpc.unary_unary_rpc_method_handler(
                    servicer.GetExchangeStatus,
                    request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                    response_serializer=exchange__pb2.GenericResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'exchange.Exchange', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('exchange.Exchange', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Exchange(object):
    """The exchange service definition.
    """

    @staticmethod
    def SubmitOrder(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,
            '/exchange.Exchange/SubmitOrder',
            exchange__pb2.OrderRequest.SerializeToString,
            exchange__pb2.GenericResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CancelOrder(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,
            '/exchange.Exchange/CancelOrder',
            exchange__pb2.CancelOrderRequest.SerializeToString,
            exchange__pb2.GenericResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CancelOrders(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,
            '/exchange.Exchange/CancelOrders',
            exchange__pb2.CancelOrdersRequest.SerializeToString,
            exchange__pb2.GenericResponseList.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetPositions(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,
            '/exchange.Exchange/GetPositions',
            exchange__pb2.GetPositionsRequest.SerializeToString,
            exchange__pb2.PositionStatus.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetExchangeStatus(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,
            '/exchange.Exchange/GetExchangeStatus',
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            exchange__pb2.GenericResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
