syntax = "proto3";

package resf.apollo.v1;

import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "apollo/proto/v1/cve.proto";
import "apollo/proto/v1/fix.proto";

option go_package = "peridot.resf.org/apollo/pb;apollopb";

message RPMs {
  repeated string nvras = 1;
}

// Advisory
//
// Product advisory
message Advisory {
  enum Type {
    TYPE_UNKNOWN = 0;
    TYPE_SECURITY = 1;
    TYPE_BUGFIX = 2;
    TYPE_ENHANCEMENT = 3;
  }

  // Type
  //
  // Type of advisory
  Type type = 1;

  // Short code
  //
  // Errata prefix or short code
  // Example: RLBA, RLEA, RLSA
  string short_code = 2;

  // Name
  //
  // Full errata name
  // Example: RLBA-2021:0001, RLSA-2021:0002
  string name = 3;

  // Synopsis
  //
  // Short description of advisory
  string synopsis = 4;

  enum Severity {
    SEVERITY_UNKNOWN = 0;
    SEVERITY_LOW = 1;
    SEVERITY_MODERATE = 2;
    SEVERITY_IMPORTANT = 3;
    SEVERITY_CRITICAL = 4;
  }

  // Severity
  //
  // Severity of advisory. Used only for security advisories
  Severity severity = 5;

  // Topic
  //
  // Topic of advisory
  // Example: An update for the go-toolset:rhel8 module is now available for Rocky Linux 8.
  string topic = 6;

  // Description
  //
  // Description of advisory. Contains information about changes and package.
  string description = 7;

  // Solution
  //
  // How to solve the advisory. Contains information about how to apply the advisory changes
  google.protobuf.StringValue solution = 8;

  // Affected products
  //
  // A list of affected products
  repeated string affected_products = 9;

  // Fixes
  //
  // A list of tickets from upstream bug trackers
  repeated Fix fixes = 10;

  // CVEs
  //
  // A list of CVEs assigned to this advisory
  repeated CVE cves = 11;

  // References
  //
  // General references used in this advisory
  repeated string references = 12;

  // Published at
  //
  // Timestamp the advisory is published at
  google.protobuf.Timestamp published_at = 13;

  // RPMs
  //
  // Affected RPMs
  map<string, RPMs> rpms = 14;

  // Reboot suggested
  //
  // Whether a system reboot should be suggested after applying this advisory
  bool reboot_suggested = 15;
}
