syntax = "proto3";

// If you make any changes make sure you run: make regenerate-proto

package gitlab.agent.agent_tracker;

option go_package = "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v18/internal/module/agent_tracker";

import "google/protobuf/timestamp.proto";
import "pkg/entity/entity.proto";
import "buf/validate/validate.proto";

// ConnectedAgentkInfo contains information about a connected agentk.
message ConnectedAgentkInfo {
  // Information about the agent sent by the agent.
  entity.AgentkMeta agent_meta = 1 [json_name = "agent_meta", (buf.validate.field).required = true];
  // When the connection was established.
  google.protobuf.Timestamp connected_at = 2 [json_name = "connected_at", (buf.validate.field).timestamp.gt = {}];
  // Uniquely identifies a particular agentk->kas connection.
  // Randomly generated when an agent connects.
  int64 connection_id = 3 [json_name = "connection_id"];
  // GitLab-wide unique id of the agent.
  int64 agent_id = 4 [json_name = "agent_id"];
  // Id of the configuration project.
  int64 project_id = 5 [json_name = "project_id"];
}

// DisconnectAgentkInfo contains information about an agentk that disconnected.
message DisconnectAgentkInfo {
  // Information about the agent sent by the agent.
  entity.AgentkMeta agent_meta = 1 [json_name = "agent_meta"];
  // Uniquely identifies a particular agentk->kas connection.
  // Randomly generated when an agent connects.
  int64 connection_id = 2 [json_name = "connection_id"];
  // GitLab-wide unique id of the agent.
  int64 agent_id = 3 [json_name = "agent_id"];
  // Id of the configuration project.
  int64 project_id = 4 [json_name = "project_id"];
}

// ConnectedAgentwInfoList contains information about a connected agentw.
message ConnectedAgentwInfo {
  // Information about the agent sent by the agent.
  entity.AgentwMeta agent_meta = 1 [json_name = "agent_meta", (buf.validate.field).required = true];
  // When the connection was established.
  google.protobuf.Timestamp connected_at = 2 [json_name = "connected_at", (buf.validate.field).timestamp.gt = {}];
  // Uniquely identifies a particular agentw->kas connection.
  // Randomly generated when an agent connects.
  int64 connection_id = 3 [json_name = "connection_id"];
  // GitLab-wide unique id of the agent.
  int64 agent_id = 4 [json_name = "agent_id"];
}

// DisconnectAgentwInfo contains information about an agentw that disconnected.
message DisconnectAgentwInfo {
  // Information about the agent sent by the agent.
  entity.AgentwMeta agent_meta = 1 [json_name = "agent_meta"];
  // Uniquely identifies a particular agentw->kas connection.
  // Randomly generated when an agent connects.
  int64 connection_id = 2 [json_name = "connection_id"];
  // GitLab-wide unique id of the agent.
  int64 agent_id = 3 [json_name = "agent_id"];
}

message AgentPodInfo {
  int64 agent_id = 1 [json_name = "agent_id"];
  int64 pod_id = 2 [json_name = "pod_id"];
}
