// Copyright 2021 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.routes.v1;

import "google/maps/routes/v1/polyline.proto";
import "google/maps/routes/v1/toll_passes.proto";
import "google/maps/routes/v1/vehicle_emission_type.proto";
import "google/maps/routes/v1/waypoint.proto";
import "google/protobuf/timestamp.proto";

option cc_enable_arenas = true;
option csharp_namespace = "Google.Maps.Routes.V1";
option go_package = "google.golang.org/genproto/googleapis/maps/routes/v1;routes";
option java_multiple_files = true;
option java_outer_classname = "ComputeRoutesRequestProto";
option java_package = "com.google.maps.routes.v1";
option objc_class_prefix = "GMRS";
option php_namespace = "Google\\Maps\\Routes\\V1";

// ComputeRoutes request message.
message ComputeRoutesRequest {
  // Required. Origin waypoint.
  Waypoint origin = 1;

  // Required. Destination waypoint.
  Waypoint destination = 2;

  // Optional. A set of waypoints along the route (excluding terminal points),
  // for either stopping at or passing by. Up to 25 intermediate waypoints are
  // supported.
  repeated Waypoint intermediates = 3;

  // Optional. Specifies the mode of transportation.
  RouteTravelMode travel_mode = 4;

  // Optional. Specifies how to compute the route. The server
  // attempts to use the selected routing preference to compute the route. If
  //  the routing preference results in an error or an extra long latency, then
  // an error is returned. In the future, we might implement a fallback
  // mechanism to use a different option when the preferred option does not give
  // a valid result. You can specify this option only when the `travel_mode` is
  // `DRIVE` or `TWO_WHEELER`, otherwise the request fails.
  RoutingPreference routing_preference = 5;

  // Optional. Specifies your preference for the quality of the polyline.
  PolylineQuality polyline_quality = 6;

  // Optional. Specifies the preferred encoding for the polyline.
  PolylineEncoding polyline_encoding = 12;

  // Optional. The departure time. If you don't set this value, then this value
  // defaults to the time that you made the request. If you set this value to a
  // time that has already occurred, then the request fails.
  google.protobuf.Timestamp departure_time = 7;

  // Specifies whether to calculate alternate routes in addition to the route.
  bool compute_alternative_routes = 8;

  // Optional. A set of conditions to satisfy that affect the way routes are
  // calculated.
  RouteModifiers route_modifiers = 9;

  // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
  // information, see
  // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See
  // [Language Support](https://developers.google.com/maps/faq#languagesupport)
  // for the list of supported languages. When you don't provide this value, the
  // display language is inferred from the location of the route request.
  string language_code = 10;

  // Optional. Specifies the units of measure for the display fields. This
  // includes the `instruction` field in `NavigationInstruction`. The units of
  // measure used for the route, leg, step distance, and duration are not
  // affected by this value. If you don't provide this value, then the display
  // units are inferred from the location of the request.
  Units units = 11;
}

// A set of values used to specify the mode of travel.
enum RouteTravelMode {
  // No travel mode specified. Defaults to `DRIVE`.
  TRAVEL_MODE_UNSPECIFIED = 0;

  // Travel by passenger car.
  DRIVE = 1;

  // Travel by bicycle.
  BICYCLE = 2;

  // Travel by walking.
  WALK = 3;

  // Two-wheeled, motorized vehicle. For example, motorcycle. Note that this
  // differs from the `BICYCLE` travel mode which covers human-powered mode.
  TWO_WHEELER = 4;

  // Travel by licensed taxi, which may allow the vehicle to travel on
  // designated taxi lanes in some areas.
  TAXI = 5;
}

// A set of values that specify factors to take into consideration when
// calculating the route.
enum RoutingPreference {
  // No routing preference specified. Default to `TRAFFIC_AWARE`.
  ROUTING_PREFERENCE_UNSPECIFIED = 0;

  // Computes routes without taking traffic conditions into consideration.
  // Suitable when traffic conditions don't matter. Using this value produces
  // the lowest latency.
  TRAFFIC_UNAWARE = 1;

  // Calculates routes taking traffic conditions into consideration. In contrast
  // to `TRAFFIC_AWARE_OPTIMAL`, some optimizations are applied to significantly
  // reduce latency.
  TRAFFIC_AWARE = 2;

  // Calculates the routes taking traffic conditions into consideration,
  // without applying most performance optimizations. Using this value produces
  // the highest latency.
  TRAFFIC_AWARE_OPTIMAL = 3;
}

// Encapsulates a set of optional conditions to satisfy when calculating the
// routes.
message RouteModifiers {
  // Specifies whether to avoid toll roads where reasonable. Preference will be
  // given to routes not containing toll roads. Applies only to the `DRIVE` and
  // `TWO_WHEELER` travel modes.
  bool avoid_tolls = 1;

  // Specifies whether to avoid highways where reasonable. Preference will be
  // given to routes not containing highways. Applies only to the `DRIVE` and
  // `TWO_WHEELER` travel modes.
  bool avoid_highways = 2;

  // Specifies whether to avoid ferries where reasonable. Preference will be
  // given to routes not containing travel by ferries.
  // Applies only to the `DRIVE` and`TWO_WHEELER` travel modes.
  bool avoid_ferries = 3;

  // Specifies whether to avoid navigating indoors where reasonable. Preference
  // will be given to routes not containing indoor navigation.
  // Applies only to the `WALK` travel mode.
  bool avoid_indoor = 4;

  // Optional. Specifies the vehicle information.
  VehicleInfo vehicle_info = 5;

  // Encapsulates information about toll passes.
  // TollPass is unset means no available pass.
  // Applies only to the DRIVE and TWO_WHEELER travel modes.
  repeated TollPass toll_passes = 6;
}

// Encapsulates the vehicle information, such as the license plate last
// character.
message VehicleInfo {
  // Specifies the license plate last character. Could be a digit or a letter.
  string license_plate_last_character = 1;

  // Describes the vehicle's emission type.
  // Applies only to the DRIVE travel mode.
  VehicleEmissionType emission_type = 2;
}

// A set of values that specify the unit of measure used in the display.
enum Units {
  // Units of measure not specified. Defaults to the unit of measure inferred
  // from the request.
  UNITS_UNSPECIFIED = 0;

  // Metric units of measure.
  METRIC = 1;

  // Imperial (English) units of measure.
  IMPERIAL = 2;
}
