syntax = "proto3";

package com.wixpress.appservice.api.upstream.wix.reliability.spi.v1;
option java_package = "com.wixpress.appservice.api.upstream.wix.reliability.spi.v1";

import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "wix/api/annotations.proto";
import "wix/spi/definitions.proto";
import "wix/api/validations.proto";
import "wix/common/spi.proto";


enum Escalation {
  BREAK_BUILD = 0;
  BLOCK_ROLLOUT = 1;
  BLOCK_FUTURE_ROLLOUT = 2;
  OPEN_BUG_SLA = 3;
  VISIBILITY = 4; // only shows violation in papi-dashboard
}

message PluginConfig {
  option (.wix.api.decomposite_of) = "wix.reliability.spi.v1.PluginConfig";
  string deployment_uri = 1 [(.wix.spi.base_uri) = true, (.wix.api.maxLength) = 1000];
  string plugin_name = 2 [(.wix.api.maxLength) = 1024]; // has to be unique across all plugins
  string plugin_display_name = 3 [(.wix.api.maxLength) = 1024]; // has to be unique across all plugins
  google.protobuf.Timestamp starting_enforcement_date = 4;
  ImportanceLevel importance_level = 5;
  repeated Constraint constraints = 6 [(.wix.api.maxSize) = 100];;

  enum ImportanceLevel {
    LOW = 0;
    MEDIUM = 1;
    HIGH = 2;
  }

  message Constraint {
    option (.wix.api.decomposite_of) = "wix.reliability.spi.v1.Constraint";
    string id = 1 [(.wix.api.maxLength) = 1024];
    repeated Consequence consequences = 2 [(.wix.api.maxSize) = 10];
    string faq_link = 3 [(.wix.api.maxLength) = 1024]; // link to FAQ docs
    google.protobuf.StringValue override_cta_message = 4 [(.wix.api.maxLength) = 1024]; // override the default cta for the constraint

  }

  message Consequence {
    option (.wix.api.decomposite_of) = "wix.reliability.spi.v1.Consequence";
    Escalation escalation = 1;
    google.protobuf.Int32Value days_to_resolve = 2; // days to resolve the violation
  }
}