/**
 * 开源代码，仅供学习和交流研究使用，商用请联系三丙
 * 微信：mohan_88888
 * 抖音：程序员三丙
 * 付费课程知识星球：https://t.zsxq.com/aKtXo
 */
syntax = "proto3";

package infrastructureProto;

import "downlink.proto";

option java_package = "sanbing.jcpp.proto.gen";
option java_outer_classname = "GrpcProto";

// gRPC 服务定义
service ProtocolInterface {
  rpc onDownlink(stream RequestMsg) returns (stream ResponseMsg) {}
}

// gRPC 请求消息
message RequestMsg {
  int64 ts = 1;
  TracerProto tracer = 2;
  ConnectRequestMsg connectRequestMsg = 10;
  DownlinkRequestMessage downlinkRequestMessage = 11;
}

// gRPC 响应消息
message ResponseMsg {
  TracerProto tracer = 2;
  ConnectResponseMsg connectResponseMsg = 12;
  DownlinkResponseMessage downlinkResponseMsg = 13;
}

// 连接请求消息
message ConnectRequestMsg {
  string nodeId = 1;
}

// 连接响应消息
message ConnectResponseMsg {
  ConnectResponseCode responseCode = 1;
  string errorMsg = 2;
}

// 连接响应状态码
enum ConnectResponseCode {
  ACCEPTED = 0;
  REFUSE = 1;
}

// 追踪信息
message TracerProto {
  string id = 1;
  string origin = 2;
  int64 ts = 3;
}
