# 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 ziplime.data.data_sources.grpc.grpc_stubs.grpc.tradeapi.v1.orders import orders_service_pb2 as grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2

GRPC_GENERATED_VERSION = '1.74.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 grpc/tradeapi/v1/orders/orders_service_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 OrdersServiceStub(object):
    def __init__(self, channel):
        self.PlaceOrder = channel.unary_unary(
                '/grpc.tradeapi.v1.orders.OrdersService/PlaceOrder',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.Order.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.FromString,
                _registered_method=True)
        self.CancelOrder = channel.unary_unary(
                '/grpc.tradeapi.v1.orders.OrdersService/CancelOrder',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.CancelOrderRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.FromString,
                _registered_method=True)
        self.GetOrders = channel.unary_unary(
                '/grpc.tradeapi.v1.orders.OrdersService/GetOrders',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrdersRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrdersResponse.FromString,
                _registered_method=True)
        self.GetOrder = channel.unary_unary(
                '/grpc.tradeapi.v1.orders.OrdersService/GetOrder',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.GetOrderRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.FromString,
                _registered_method=True)
        self.SubscribeOrderTrade = channel.stream_stream(
                '/grpc.tradeapi.v1.orders.OrdersService/SubscribeOrderTrade',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderTradeRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderTradeResponse.FromString,
                _registered_method=True)


class OrdersServiceServicer(object):

    def PlaceOrder(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CancelOrder(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetOrders(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetOrder(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SubscribeOrderTrade(self, request_iterator, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_OrdersServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'PlaceOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.PlaceOrder,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.Order.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.SerializeToString,
            ),
            'CancelOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.CancelOrder,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.CancelOrderRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.SerializeToString,
            ),
            'GetOrders': grpc.unary_unary_rpc_method_handler(
                    servicer.GetOrders,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrdersRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrdersResponse.SerializeToString,
            ),
            'GetOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.GetOrder,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.GetOrderRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.SerializeToString,
            ),
            'SubscribeOrderTrade': grpc.stream_stream_rpc_method_handler(
                    servicer.SubscribeOrderTrade,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderTradeRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderTradeResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'grpc.tradeapi.v1.orders.OrdersService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('grpc.tradeapi.v1.orders.OrdersService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class OrdersService(object):
    @staticmethod
    def PlaceOrder(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,
            '/grpc.tradeapi.v1.orders.OrdersService/PlaceOrder',
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.Order.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.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,
            '/grpc.tradeapi.v1.orders.OrdersService/CancelOrder',
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.CancelOrderRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetOrders(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,
            '/grpc.tradeapi.v1.orders.OrdersService/GetOrders',
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrdersRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrdersResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetOrder(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,
            '/grpc.tradeapi.v1.orders.OrdersService/GetOrder',
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.GetOrderRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderState.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeOrderTrade(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/grpc.tradeapi.v1.orders.OrdersService/SubscribeOrderTrade',
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderTradeRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_orders_dot_orders__service__pb2.OrderTradeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
