syntax = "proto3";

package google.maps.weather.v1;

import "google/api/field_behavior.proto";

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

// Represents a set of precipitation values at a given location.
// (-- Next available tag: 5 --)
message Precipitation {
  // The probability of precipitation (values from 0 to 100).
  PrecipitationProbability probability = 1;

  // (-- Removed QuantitativePrecipitationForecast rain_qpf. --)
  reserved 2;

  // The amount of snow, measured as liquid water equivalent, that has
  // accumulated over a period of time.
  // Note: QPF is an abbreviation for Quantitative Precipitation Forecast
  // (please see the QuantitativePrecipitationForecast definition for more
  // details).
  QuantitativePrecipitationForecast snow_qpf = 3;

  // The amount of precipitation rain, measured as liquid water
  // equivalent, that has accumulated over a period of time. Note: QPF is an
  // abbreviation for Quantitative Precipitation Forecast (please see the
  // QuantitativePrecipitationForecast definition for more details).
  QuantitativePrecipitationForecast qpf = 4;
}

// Represents the probability of precipitation at a given location.
// (-- This is a generic (shared) definition because it might be used as a
// standalone field for other endpoints/new features in the future. --)
// (-- Next available tag: 3 --)
message PrecipitationProbability {
  // A percentage from 0 to 100 that indicates the chances of precipitation.
  optional int32 percent = 1;

  // Represents the type of precipitation at a given location.
  enum Type {
    // Unspecified precipitation type.
    TYPE_UNSPECIFIED = 0;

    // No precipitation.
    NONE = 8;

    // Snow precipitation.
    SNOW = 1;

    // Rain precipitation.
    RAIN = 2;

    // Light rain precipitation.
    LIGHT_RAIN = 3;

    // Heavy rain precipitation.
    HEAVY_RAIN = 4;

    // Both rain and snow precipitations.
    RAIN_AND_SNOW = 5;

    // Sleet precipitation.
    SLEET = 6;

    // Freezing rain precipitation.
    FREEZING_RAIN = 7;

    // Hail precipitation.
    PRECIPITATION_TYPE_HAIL = 9;
  }
  // A code that indicates the type of precipitation.
  // (-- aip.dev/not-precedent: Field type changed to nested enum per atomic
  //     transition strategy. Wire-compatible; external consumers
  //     rely exclusively on HTTP REST/JSON where enum strings remain identical.
  //     --)
  Type type = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Represents the expected amount of melted precipitation accumulated over a
// specified time period over a specified area (reference:
// https://en.wikipedia.org/wiki/Quantitative_precipitation_forecast) -
// usually abbreviated QPF for short.
// (-- This is a generic (shared) definition because it is used also as a
// standalone field in the CurrentConditionsHistory message. --)
// (-- Next available tag: 3 --)
message QuantitativePrecipitationForecast {
  // Represents the unit used to measure the amount of accumulated
  // precipitation.
  // (-- These units are private to this definition to avoid conflicts with
  // similar length units used in other definitions (i.e.: QPF is measured in
  // millimeters while visibility is measured in kilometers). --)
  // (-- Next available tag: 4 --)
  enum Unit {
    // Unspecified precipitation unit.
    UNIT_UNSPECIFIED = 0;

    // (-- Removed CENTIMETERS --)
    reserved 1;

    // The amount of precipitation is measured in millimeters.
    MILLIMETERS = 3;

    // The amount of precipitation is measured in inches.
    INCHES = 2;
  }

  // The amount of precipitation, measured as liquid water equivalent, that has
  // accumulated over a period of time.
  optional float quantity = 1;

  // The code of the unit used to measure the amount of accumulated
  // precipitation.
  Unit unit = 2;
}

// Represents the type of precipitation at a given location.
// (-- This is a generic (shared) definition because it might be used as a
// standalone field for other endpoints/new features in the future. --)
// (-- Next available tag: 10 --)
enum PrecipitationType {
  // Unspecified precipitation type.
  PRECIPITATION_TYPE_UNSPECIFIED = 0;

  // No precipitation.
  NONE = 8;

  // Snow precipitation.
  SNOW = 1;

  // Rain precipitation.
  RAIN = 2;

  // Light rain precipitation.
  LIGHT_RAIN = 3;

  // Heavy rain precipitation.
  HEAVY_RAIN = 4;

  // Both rain and snow precipitations.
  RAIN_AND_SNOW = 5;

  // Sleet precipitation.
  SLEET = 6;

  // Freezing rain precipitation.
  FREEZING_RAIN = 7;

  // Hail precipitation.
  PRECIPITATION_TYPE_HAIL = 9;
}
