1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package maps.fleetengine.delivery.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/maps/fleetengine/delivery/v1/common.proto"; 22import "google/protobuf/duration.proto"; 23import "google/protobuf/wrappers.proto"; 24import "google/type/latlng.proto"; 25 26option csharp_namespace = "Google.Maps.FleetEngine.Delivery.V1"; 27option go_package = "cloud.google.com/go/maps/fleetengine/delivery/apiv1/deliverypb;deliverypb"; 28option java_multiple_files = true; 29option java_outer_classname = "DeliveryVehicles"; 30option java_package = "google.maps.fleetengine.delivery.v1"; 31option objc_class_prefix = "CFED"; 32 33// The `DeliveryVehicle` message. A delivery vehicle transports shipments from a 34// depot to a delivery location, and from a pickup location to the depot. In 35// some cases, delivery vehicles also transport shipments directly from the 36// pickup location to the delivery location. 37// 38// Note: gRPC and REST APIs use different field naming conventions. For example, 39// the `DeliveryVehicle.current_route_segment` field in the gRPC API and the 40// `DeliveryVehicle.currentRouteSegment` field in the REST API refer to the same 41// field. 42message DeliveryVehicle { 43 option (google.api.resource) = { 44 type: "fleetengine.googleapis.com/DeliveryVehicle" 45 pattern: "providers/{provider}/deliveryVehicles/{vehicle}" 46 }; 47 48 // The type of delivery vehicle. 49 enum DeliveryVehicleType { 50 // The value is unused. 51 DELIVERY_VEHICLE_TYPE_UNSPECIFIED = 0; 52 53 // An automobile. 54 AUTO = 1; 55 56 // A motorcycle, moped, or other two-wheeled vehicle 57 TWO_WHEELER = 2; 58 59 // Human-powered transport. 60 BICYCLE = 3; 61 62 // A human transporter, typically walking or running, traveling along 63 // pedestrian pathways. 64 PEDESTRIAN = 4; 65 } 66 67 // The unique name of this Delivery Vehicle. 68 // The format is `providers/{provider}/deliveryVehicles/{vehicle}`. 69 string name = 1; 70 71 // The last reported location of the Delivery Vehicle. 72 DeliveryVehicleLocation last_location = 2; 73 74 // The Delivery Vehicle's navigation status. 75 DeliveryVehicleNavigationStatus navigation_status = 3; 76 77 // The encoded polyline specifying the route that the navigation recommends 78 // taking to the next waypoint. Your driver app updates this when a 79 // stop is reached or passed, and when the navigation reroutes. These 80 // `LatLng`s are returned in 81 // `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` 82 // (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` 83 // (REST) for all active Tasks assigned to the Vehicle. 84 // 85 // There are a few cases where this field might not be used to populate 86 // `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` 87 // (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` 88 // (REST): 89 // 90 // * The endpoint of the `current_route_segment` does not match 91 // `DeliveryVehicle.remaining_vehicle_journey_segments[0].stop` (gRPC) or 92 // `DeliveryVehicle.remainingVehicleJourneySegments[0].stop` (REST). 93 // 94 // * The driver app has not updated its location recently, so the last 95 // updated value for this field might be stale. 96 // 97 // * The driver app has recently updated its location, but the 98 // `current_route_segment` is stale, and points to a previous vehicle stop. 99 // 100 // In these cases, Fleet Engine populates this field with a route from the 101 // most recently passed VehicleStop to the upcoming VehicleStop to ensure that 102 // the consumer of this field has the best available information on the 103 // current path of the Delivery Vehicle. 104 bytes current_route_segment = 4; 105 106 // The location where the `current_route_segment` ends. This is not currently 107 // populated by the driver app, but you can supply it on 108 // `UpdateDeliveryVehicle` calls. It is either the `LatLng` from the upcoming 109 // vehicle stop, or the last `LatLng` of the `current_route_segment`. Fleet 110 // Engine will then do its best to interpolate to an actual `VehicleStop`. 111 // 112 // This field is ignored in `UpdateDeliveryVehicle` calls if the 113 // `current_route_segment` field is empty. 114 google.type.LatLng current_route_segment_end_point = 5; 115 116 // The remaining driving distance for the `current_route_segment`. 117 // The Driver app typically provides this field, but there are some 118 // circumstances in which Fleet Engine will override the value sent by the 119 // app. For more information, see 120 // [DeliveryVehicle.current_route_segment][maps.fleetengine.delivery.v1.DeliveryVehicle.current_route_segment]. 121 // This field is returned in 122 // `Task.remaining_vehicle_journey_segments[0].driving_distance_meters` (gRPC) 123 // or `Task.remainingVehicleJourneySegments[0].drivingDistanceMeters` (REST) 124 // for all active `Task`s assigned to the Delivery Vehicle. 125 // 126 // Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the 127 // `current_route_segment` field is empty. 128 google.protobuf.Int32Value remaining_distance_meters = 6; 129 130 // The remaining driving time for the `current_route_segment`. 131 // The Driver app typically provides this field, but there are some 132 // circumstances in which Fleet Engine will override the value sent by the 133 // app. For more information, see 134 // [DeliveryVehicle.current_route_segment][maps.fleetengine.delivery.v1.DeliveryVehicle.current_route_segment]. 135 // This field is returned in 136 // `Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or 137 // `Task.remainingVehicleJourneySegments[0].drivingDuration` (REST) for all 138 // active tasks assigned to the Delivery Vehicle. 139 // 140 // Fleet Engine ignores this field in `UpdateDeliveryVehicleRequest` if the 141 // `current_route_segment` field is empty. 142 google.protobuf.Duration remaining_duration = 7; 143 144 // The journey segments assigned to this Delivery Vehicle, starting from the 145 // Vehicle's most recently reported location. This field won't be populated 146 // in the response of `ListDeliveryVehicles`. 147 repeated VehicleJourneySegment remaining_vehicle_journey_segments = 8; 148 149 // A list of custom Delivery Vehicle attributes. A Delivery Vehicle can have 150 // at most 100 attributes, and each attribute must have a unique key. 151 repeated DeliveryVehicleAttribute attributes = 9; 152 153 // The type of this delivery vehicle. If unset, this will default to `AUTO`. 154 DeliveryVehicleType type = 10; 155} 156 157// A location with any additional identifiers. 158message LocationInfo { 159 // The location's coordinates. 160 google.type.LatLng point = 1; 161} 162 163// Represents a Vehicle’s travel segment - from its previous stop to the 164// current stop. If it is the first active stop, then it is from the 165// Vehicle’s current location to this stop. 166message VehicleJourneySegment { 167 // Specifies the stop location, along with the `Task`s associated with 168 // the stop. Some fields of the VehicleStop might not be present if this 169 // journey segment is part of `JourneySharingInfo`. 170 VehicleStop stop = 1; 171 172 // Output only. The travel distance from the previous stop to this stop. 173 // If the current stop is the first stop in the list of journey 174 // segments, then the starting point is the vehicle's location recorded 175 // at the time that this stop was added to the list. This field might not be 176 // present if this journey segment is part of `JourneySharingInfo`. 177 google.protobuf.Int32Value driving_distance_meters = 2 178 [(google.api.field_behavior) = OUTPUT_ONLY]; 179 180 // Output only. The travel time from the previous stop to this stop. 181 // If the current stop is the first stop in the list of journey 182 // segments, then the starting point is the Vehicle's location recorded 183 // at the time that this stop was added to the list. 184 // 185 // If this field is defined in the path 186 // `Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or 187 // `Task.remainingVehicleJourneySegments[0].drivingDuration` (REST), 188 // then it may be populated with the value from 189 // `DeliveryVehicle.remaining_duration` (gRPC) or 190 // `DeliveryVehicle.remainingDuration` (REST). 191 // This provides the remaining driving duration from the driver app's latest 192 // known location rather than the driving time from the previous stop. 193 google.protobuf.Duration driving_duration = 3 194 [(google.api.field_behavior) = OUTPUT_ONLY]; 195 196 // Output only. The path from the previous stop to this stop. If the current 197 // stop is the first stop in the list of journey segments, then this is the 198 // path from the vehicle's current location to this stop at the time that the 199 // stop was added to the list. This field might not be present if this journey 200 // segment is part of `JourneySharingInfo`. 201 // 202 // If this field is defined in the path 203 // `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` 204 // (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` 205 // (REST), then it may be populated with the `LatLng`s decoded from 206 // `DeliveryVehicle.current_route_segment` (gRPC) or 207 // `DeliveryVehicle.currentRouteSegment` (REST). This provides the driving 208 // path from the driver app's latest known location rather than the path from 209 // the previous stop. 210 repeated google.type.LatLng path = 5 211 [(google.api.field_behavior) = OUTPUT_ONLY]; 212} 213 214// Describes a point where a Vehicle stops to perform one or more `Task`s. 215message VehicleStop { 216 // Additional information about the Task performed at this stop. 217 message TaskInfo { 218 // The Task ID. This field won't be populated in the response of either a 219 // `GetTask`, or a `SearchTasks` call. Task IDs are subject to the following 220 // restrictions: 221 // 222 // * Must be a valid Unicode string. 223 // * Limited to a maximum length of 64 characters. 224 // * Normalized according to [Unicode Normalization Form C] 225 // (http://www.unicode.org/reports/tr15/). 226 // * May not contain any of the following ASCII characters: '/', ':', '?', 227 // ',', or '#'. 228 string task_id = 1; 229 230 // Output only. The time required to perform the Task. 231 google.protobuf.Duration task_duration = 2 232 [(google.api.field_behavior) = OUTPUT_ONLY]; 233 234 // Output only. The time window during which the task should be completed. 235 // This is only set in the response to `GetDeliveryVehicle`. 236 TimeWindow target_time_window = 3 237 [(google.api.field_behavior) = OUTPUT_ONLY]; 238 } 239 240 // The current state of a `VehicleStop`. 241 enum State { 242 // Unknown. 243 STATE_UNSPECIFIED = 0; 244 245 // Created, but not actively routing. 246 NEW = 1; 247 248 // Assigned and actively routing. 249 ENROUTE = 2; 250 251 // Arrived at stop. Assumes that when the Vehicle is routing to the next 252 // stop, that all previous stops have been completed. 253 ARRIVED = 3; 254 } 255 256 // Required. The location of the stop. Note that the locations in the `Task`s 257 // might not exactly match this location, but will be within a short distance 258 // of it. This field won't be populated in the response of either a `GetTask`, 259 // or a `SearchTasks` call. 260 LocationInfo planned_location = 1 [(google.api.field_behavior) = REQUIRED]; 261 262 // The list of `Task`s to be performed at this stop. This field won't be 263 // populated in the response of either a `GetTask` or `SearchTasks` call. 264 repeated TaskInfo tasks = 2; 265 266 // The state of the `VehicleStop`. This field won't be populated in the 267 // response of either a `GetTask`, or a `SearchTasks` call. 268 State state = 3; 269} 270