# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from ttn.github_com.TheThingsNetwork.api.broker import broker_pb2 as github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class BrokerStub(object):
  """The Broker service provides pure network functionality
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.Associate = channel.stream_stream(
        '/broker.Broker/Associate',
        request_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.UplinkMessage.SerializeToString,
        response_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DownlinkMessage.FromString,
        )
    self.Subscribe = channel.unary_stream(
        '/broker.Broker/Subscribe',
        request_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.SubscribeRequest.SerializeToString,
        response_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DeduplicatedUplinkMessage.FromString,
        )
    self.Publish = channel.stream_unary(
        '/broker.Broker/Publish',
        request_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DownlinkMessage.SerializeToString,
        response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
        )
    self.Activate = channel.unary_unary(
        '/broker.Broker/Activate',
        request_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DeviceActivationRequest.SerializeToString,
        response_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DeviceActivationResponse.FromString,
        )


class BrokerServicer(object):
  """The Broker service provides pure network functionality
  """

  def Associate(self, request_iterator, context):
    """Router initiates an Association with the Broker.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Subscribe(self, request, context):
    """Handler subscribes to uplink stream.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Publish(self, request_iterator, context):
    """Handler initiates downlink stream.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def Activate(self, request, context):
    """Router requests device activation
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BrokerServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'Associate': grpc.stream_stream_rpc_method_handler(
          servicer.Associate,
          request_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.UplinkMessage.FromString,
          response_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DownlinkMessage.SerializeToString,
      ),
      'Subscribe': grpc.unary_stream_rpc_method_handler(
          servicer.Subscribe,
          request_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.SubscribeRequest.FromString,
          response_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DeduplicatedUplinkMessage.SerializeToString,
      ),
      'Publish': grpc.stream_unary_rpc_method_handler(
          servicer.Publish,
          request_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DownlinkMessage.FromString,
          response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
      ),
      'Activate': grpc.unary_unary_rpc_method_handler(
          servicer.Activate,
          request_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DeviceActivationRequest.FromString,
          response_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.DeviceActivationResponse.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'broker.Broker', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))


class BrokerManagerStub(object):
  """The BrokerManager service provides configuration and monitoring functionality
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.RegisterApplicationHandler = channel.unary_unary(
        '/broker.BrokerManager/RegisterApplicationHandler',
        request_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.ApplicationHandlerRegistration.SerializeToString,
        response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
        )
    self.GetStatus = channel.unary_unary(
        '/broker.BrokerManager/GetStatus',
        request_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.StatusRequest.SerializeToString,
        response_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.Status.FromString,
        )


class BrokerManagerServicer(object):
  """The BrokerManager service provides configuration and monitoring functionality
  """

  def RegisterApplicationHandler(self, request, context):
    """Handler announces a new application to Broker. This is a temporary method that will be removed
    when we can push updates from the Discovery service to the routing services.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetStatus(self, request, context):
    """Network operator requests Broker status
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_BrokerManagerServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'RegisterApplicationHandler': grpc.unary_unary_rpc_method_handler(
          servicer.RegisterApplicationHandler,
          request_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.ApplicationHandlerRegistration.FromString,
          response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
      ),
      'GetStatus': grpc.unary_unary_rpc_method_handler(
          servicer.GetStatus,
          request_deserializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.StatusRequest.FromString,
          response_serializer=github__com_dot_TheThingsNetwork_dot_api_dot_broker_dot_broker__pb2.Status.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'broker.BrokerManager', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
