syntax = "proto3";


service AgentVersions {
  rpc Add(Version) returns (Version) {};
  rpc SwitchTarget(SwitchTargetRequest) returns (Version) {};
  rpc ChangeStatus(ChangeStatusRequest) returns (Version) {};
  rpc DeprecateUpTo(DeprecateUpToRequest) returns (VersionsList) {};
  rpc OutdateUpTo(OutdateUpToRequest) returns (VersionsList) {};
}

enum VersionStatus {
  VERSION_STATUS_UNSPECIFIED = 0;
  TARGET = 1;
  ACTUAL = 2;
  DEPRECATED = 3;
  OUTDATED = 4;
  TESTING = 5;
}

message Version {
  string id = 1;
  VersionStatus status = 2;
  int64 revision = 3;
  string description = 4;
  string hash = 5;
}

message SwitchTargetRequest {
  string id = 1;
}

message ChangeStatusRequest {
  string id = 1;
  VersionStatus status = 2;
}

message DeprecateUpToRequest {
  string id = 1;
}

message OutdateUpToRequest {
  string id = 1;
}

message VersionsList {
  repeated Version versions = 1;
}


