syntax = "proto3";

package Sindika.AspNet.App005.Services;

// Define the TrainingAgentService
service TrainingAgentService {
  // System Usage Service
  rpc SendSystemUsage(TrainingAgentSystemUsageRequest)
      returns (TrainingAgentSystemUsageResponse);

  // Update Status Service
  rpc UpdateStatus(UpdateTrainingAgentStatusRequest)
      returns (UpdateTrainingAgentStatusResponse);

  // Connection Info Service
  rpc GetConnectionInfo(GetConnectionInfoRequest)
      returns (GetConnectionInfoResponse);
}

// Message for System Usage
message TrainingAgentSystemUsageRequest {
  string token = 1;            // Authentication token for the training agent
  float cpu_usage = 2;         // CPU usage in percentage
  float cpu_temperature = 3;   // CPU temperature (or error)
  float ram_usage_percent = 4; // RAM usage in percentage
  uint64 ram_total = 5;        // Total RAM in bytes
  uint64 ram_used = 6;         // Used RAM in bytes
  uint64 ram_free = 7;         // Free RAM in bytes
  repeated TrainingAgentGPUUsage gpu = 8; // GPU details
  float latency_ms = 9;                   // Network latency in milliseconds
}

message TrainingAgentGPUUsage {
  int32 gpu_index = 1;            // GPU index
  float gpu_usage_percent = 2;    // GPU usage in percentage
  float memory_usage_percent = 3; // GPU memory usage in percentage
  float temperature_celsius = 4;  // GPU temperature in Celsius
  uint64 total_memory = 5;        // Total GPU memory in bytes
  uint64 used_memory = 6;         // Used GPU memory in bytes
  uint64 free_memory = 7;         // Free GPU memory in bytes
}

message TrainingAgentSystemUsageResponse {
  bool success = 1;   // Indicates if sending data was successful
  string message = 2; // Additional information
}

// UPDATE STATUS
message UpdateTrainingAgentStatusRequest {
  string token = 1; // Authentication token for the training agent
  string status_code = 2;
  int64 timestamp = 3;
}

message UpdateTrainingAgentStatusResponse {
  bool success = 1;
  string message = 2;
}

// Message for Connection Info
message GetConnectionInfoRequest { string token = 1; }

message GetConnectionInfoResponse {
  bool success = 1;
  string message = 2;
  string rabbitmq_host = 3;
  int32 rabbitmq_port = 4;
  string rabbitmq_username = 5;
  string rabbitmq_password = 6;
  optional string id = 7; // Optional identifier for the training agent
}
