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/agentk/agentk.proto";
import "pkg/entity/agentw/agentw.proto";
import "pkg/entity/runnerc/runnerc.proto";
import "buf/validate/validate.proto";

// ConnectedAgentkInfo contains information about a connected agentk.
message ConnectedAgentkInfo {
  // Information about the agent sent by the agent.
  entity.agentk.Meta 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.agentk.Meta 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.agentw.Meta 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 workspace.
  int64 workspace_id = 4 [json_name = "workspace_id"];
}

// DisconnectAgentwInfo contains information about an agentw that disconnected.
message DisconnectAgentwInfo {
  // Information about the agent sent by the agent.
  entity.agentw.Meta 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 workspace.
  int64 workspace_id = 3 [json_name = "workspace_id"];
}

// ConnectedRunnerControllerInfo contains information about a connected runnerc.
message ConnectedRunnerControllerInfo {
  // Information about the agent sent by the agent.
  entity.runnerc.Meta 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 runnerc->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"];
}

// DisconnectRunnerControllerInfo contains information about an runnerc that disconnected.
message DisconnectRunnerControllerInfo {
  // Information about the agent sent by the agent.
  entity.runnerc.Meta agent_meta = 1 [json_name = "agent_meta"];
  // Uniquely identifies a particular runnerc->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"];
}
