syntax = "proto3";

package mengya.v1;

option go_package = "mengyamonitor-backend-server/internal/gen/mengyav1;mengyav1";

// AgentIngest: 采集端出站连接，双向流上报指标。
service AgentIngest {
  rpc Connect(stream AgentMessage) returns (stream ControlMessage);
}

message AgentMessage {
  oneof payload {
    Hello hello = 1;
    Heartbeat heartbeat = 2;
    MetricsReport metrics = 3;
  }
}

message Hello {
  string server_id = 1;
  string agent_key = 2;
  string hostname = 3;
}

message Heartbeat {}

message MetricsReport {
  string payload_json = 1;
  int64 collected_at_unix_ms = 2;
}

message ControlMessage {
  oneof payload {
    Ack ack = 1;
  }
}

message Ack {
  string message = 1;
}
