// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.maps.weather.v1;

import "google/maps/weather/v1/public_alerts_enums.proto";
import "google/protobuf/timestamp.proto";
import "google/type/localized_text.proto";

option java_multiple_files = true;
option java_package = "com.google.maps.weather.v1";
option java_outer_classname = "PublicAlertsProto";
option csharp_namespace = "Google.Geo.Weather.V1";
option php_namespace = "Google\\Geo\\Weather\\V1";
option objc_class_prefix = "GMWV1";
option go_package = "cloud.google.com/go/maps/weather/apiv1/weatherpb;weatherpb";

// Represents a link to a data source.
message DataSource {
  // The publisher of the alert.
  Publisher publisher = 1;

  // Official publisher name. Please note that while this field should be
  // localized, it is not guaranteed that it will be.
  string name = 2;

  // The URL of the authority's website.
  string authority_uri = 3;
}

// Represents a safety recommendation.
message SafetyRecommendation {
  // A directive to the user. Please note that while this field should be
  // localized, it is not guaranteed that it will be.
  string directive = 1;

  // An optional subtext for the directive, which may contain additional
  // context for the user. Please note that while this field should be
  // localized, it is not guaranteed that it will be.
  optional string subtext = 2;
}

// Represents the public weather alerts.
message PublicAlerts {
  // The unique identifier for this alert.
  string alert_id = 1;

  // The localized title for the alert.
  google.type.LocalizedText alert_title = 2;

  // The type of weather event.
  WeatherEventType event_type = 3;

  // The name of the area where the alert is issued.
  string area_name = 4;

  // A GeoJSON representation of the areas where the alert is issued.
  //
  // The GeoJSON data must be in RFC 7946 format and represent either a
  // Polygon (for a single contiguous area) or a MultiPolygon (for multiple
  // distinct areas).
  //
  // Example:
  //
  // {
  //  "type": "Polygon",
  //   "coordinates": [
  //       [
  //           [-1, -1], [-1, 0], [0, 0], [-1, -1]
  //       ]
  //   ]
  // }
  //
  // A sample MultiPolygon GeoJson string looks like:
  //
  // {
  //  "type": "MultiPolygon",
  //   "coordinates": [
  //       [
  //           [0, 0], [-1, 0], [-1, 1], [0, 0]
  //       ],
  //       [
  //           [0, 0], [-2, 0], [-2, 2], [0, 0]
  //       ]
  //   ]
  optional string polygon = 5;

  // The latest text describing the alert as issued by the official authority.
  // Please note that while this field should be localized, it is not guaranteed
  // that it will be.
  optional string description = 6;

  // The severity level of the alert.
  Severity severity = 7;

  // The certainty of the alert.
  optional Certainty certainty = 8;

  // The urgency of the alert.
  optional Urgency urgency = 9;

  // Instructions recommended by the publisher. Please note that while this
  // field should be localized, it is not guaranteed that it will be.
  repeated string instruction = 10;

  // Safety recommendations directive to the user, these can be provided by the
  // publisher or other authorities.
  repeated SafetyRecommendation safety_recommendations = 11;

  // The timezone offset of the event, in +/-HH:MM format.
  string timezone_offset = 12;

  // The start time of the event.
  google.protobuf.Timestamp start_time = 13;

  // The expiration time of the event.
  google.protobuf.Timestamp expiration_time = 14;

  // Details of the publisher that issued the alert.
  DataSource data_source = 15;
}
