syntax = "proto3";

package worldmonitor.natural.v1;

import "sebuf/http/annotations.proto";

message NaturalEvent {
  string id = 1;
  string title = 2;
  string description = 3;
  string category = 4;
  string category_title = 5;
  double lat = 6;
  double lon = 7;
  int64 date = 8 [(sebuf.http.int64_encoding) = INT64_ENCODING_NUMBER];
  double magnitude = 9;
  string magnitude_unit = 10;
  string source_url = 11;
  string source_name = 12;
  bool closed = 13;

  // Optional tropical cyclone fields (populated for severeStorms from GDACS TC / NHC)
  optional string storm_id = 14;
  optional string storm_name = 15;
  optional string basin = 16;
  optional int32 storm_category = 17;
  optional string classification = 18;
  optional int32 wind_kt = 19;
  optional int32 pressure_mb = 20;
  optional int32 movement_dir = 21;
  optional int32 movement_speed_kt = 22;
  repeated ForecastPoint forecast_track = 23;
  repeated CoordRing cone_polygon = 24;
  repeated PastTrackPoint past_track = 25;
}

message ForecastPoint {
  double lat = 1;
  double lon = 2;
  int32 hour = 3;
  int32 wind_kt = 4;
  int32 category = 5;
}

message PastTrackPoint {
  double lat = 1;
  double lon = 2;
  int32 wind_kt = 3;
  int64 timestamp = 4 [(sebuf.http.int64_encoding) = INT64_ENCODING_NUMBER];
}

message Coordinate {
  double lon = 1;
  double lat = 2;
}

message CoordRing {
  repeated Coordinate points = 1;
}

message ListNaturalEventsRequest {
  // Accepted but currently ignored; no-op until this handler supports the parameter.
  int32 days = 1 [(sebuf.http.query) = { name: "days" }, (sebuf.http.unimplemented) = true];
}

message ListNaturalEventsResponse {
  // Natural events from the last successful seed snapshot.
  repeated NaturalEvent events = 1;

  // Time the seed snapshot was fetched, as Unix epoch milliseconds. A value of
  // 0 means the snapshot is unavailable/degraded, not that there are confirmed
  // zero natural events.
  int64 fetched_at = 2 [(sebuf.http.int64_encoding) = INT64_ENCODING_NUMBER];

  // True when events came from a seed snapshot. False means an empty payload is
  // graceful degradation because the snapshot is unavailable.
  bool data_available = 3;
}
