syntax = "proto3";

package resf.secparse.admin;

import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "validate/validate.proto";

option go_package = "peridot.resf.org/secparse/admin/proto/v1;secparseadminpb";

enum ShortCodeMode {
  UnknownMode = 0;
  PublishMode = 1;
  MirrorRedHatMode = 2;
}

message ShortCode {
  // Code
  //
  // Full short code
  string code = 1;

  // Mode
  //
  // Mode for short code
  // Currently only publish and mirror is supported
  // Mirror only mirrors another advisory upstream and will NOT allow publishing
  // from the same short code
  ShortCodeMode mode = 2;

  // Archived
  //
  // Whether the short code is archived or not
  // An archived short code CANNOT be used to issue errata
  bool archived = 3;
}

message GetShortCodeRequest {
  string code = 1;
}

message GetShortCodeResponse {
  ShortCode short_code = 1;
}

message ListShortCodesRequest {
  string page_token = 1;
  int32 page_size = 2;
}

message ListShortCodesResponse {
  repeated ShortCode short_codes = 1;
  google.protobuf.StringValue next_page_token = 2;
}

message CreateShortCodeRequest {
  string code = 1 [(validate.rules).string.min_len = 1];
  ShortCodeMode mode = 2 [(validate.rules).enum = {not_in: [0]}];
  google.protobuf.Timestamp mirror_from_date = 3;
  int32 redhat_major_version = 4;
}

message CreateShortCodeResponse {
  ShortCode short_code = 1;
}
