syntax = "proto3";

package worldmonitor.resilience.v1;

import "sebuf/http/annotations.proto";
import "worldmonitor/resilience/v1/resilience.proto";

message GetResilienceScoreRequest {
  string country_code = 1 [(sebuf.http.query) = { name: "countryCode", required: true }];
}

message ScoreInterval {
  double p05 = 1;
  double p95 = 2;
}

message GetResilienceScoreResponse {
  string country_code = 1;
  double overall_score = 2;
  string level = 3;
  repeated ResilienceDomain domains = 4;
  reserved 5;
  string trend = 6;
  double change_30d = 7;
  bool low_confidence = 8;
  double imputation_share = 9;
  double baseline_score = 10;
  double stress_score = 11;
  double stress_factor = 12;
  string data_version = 13;
  ScoreInterval score_interval = 14;
  // Phase 2 T2.1: three-pillar schema. Empty array when
  // schema_version == "1.0" (the default until Phase 2 T2.3 lands).
  // Populated with shaped-but-empty pillar entries when
  // schema_version == "2.0"; real scores/coverage land in T2.3 / PR 4.
  repeated ResiliencePillar pillars = 15;
  // Phase 2 T2.1: "1.0" (default, preserves the current response shape)
  // or "2.0" (adds pillars; keeps overall_score / baseline_score / etc.
  // populated for one release cycle for backward compat). Controlled at
  // response build time by the RESILIENCE_SCHEMA_V2_ENABLED env flag.
  string schema_version = 16;
}
