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/maps/fleetengine/delivery/v1/delivery_vehicles.proto"; 23import "google/protobuf/duration.proto"; 24import "google/protobuf/timestamp.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 = "Tasks"; 30option java_package = "google.maps.fleetengine.delivery.v1"; 31option objc_class_prefix = "CFED"; 32 33// A Task in the Delivery API represents a single action to track. In general, 34// there is a distinction between shipment-related Tasks and break Tasks. A 35// shipment can have multiple Tasks associated with it. For example, there could 36// be one Task for the pickup, and one for the drop-off or transfer. Also, 37// different Tasks for a given shipment can be handled by different vehicles. 38// For example, one vehicle could handle the pickup, driving the shipment to the 39// hub, while another vehicle drives the same shipment from the hub to the 40// drop-off location. 41// 42// Note: gRPC and REST APIs use different field naming conventions. For example, 43// the `Task.journey_sharing_info` field in the gRPC API and the 44// `Task.journeySharingInfo` field in the REST API refer to the same 45// field. 46message Task { 47 option (google.api.resource) = { 48 type: "fleetengine.googleapis.com/Task" 49 pattern: "providers/{provider}/tasks/{task}" 50 }; 51 52 // The type of Task. 53 enum Type { 54 // Default, the Task type is unknown. 55 TYPE_UNSPECIFIED = 0; 56 57 // A pickup Task is the action taken for picking up a shipment from a 58 // customer. Depot or feeder vehicle pickups should use the `SCHEDULED_STOP` 59 // type. 60 PICKUP = 1; 61 62 // A delivery Task is the action taken for delivering a shipment to an end 63 // customer. Depot or feeder vehicle dropoffs should use the 64 // `SCHEDULED_STOP` type. 65 DELIVERY = 2; 66 67 // A scheduled stop Task is used for planning purposes. For example, it 68 // could represent picking up or dropping off shipments from feeder vehicles 69 // or depots. It shouldn't be used for any shipments that are picked up or 70 // dropped off from an end customer. 71 SCHEDULED_STOP = 3; 72 73 // A Task that means the Vehicle is not available for service. For example, 74 // this can happen when the driver takes a break, or when the vehicle 75 // is being refueled. 76 UNAVAILABLE = 4; 77 } 78 79 // The state of a Task. This indicates the Tasks's progress. 80 enum State { 81 // Default. Used for an unspecified or unrecognized Task state. 82 STATE_UNSPECIFIED = 0; 83 84 // Either the Task has not yet been assigned to a delivery vehicle, or the 85 // delivery vehicle has not yet passed the `Task`'s assigned vehicle stop. 86 OPEN = 1; 87 88 // When the vehicle passes the vehicle stop for this Task. 89 CLOSED = 2; 90 } 91 92 // The outcome of attempting to execute a Task. When `TaskState` is closed, 93 // `TaskOutcome` indicates whether it was completed successfully. 94 enum TaskOutcome { 95 // The Task outcome before its value is set. 96 TASK_OUTCOME_UNSPECIFIED = 0; 97 98 // The Task completed successfully. 99 SUCCEEDED = 1; 100 101 // Either the Task couldn't be completed, or it was cancelled. 102 FAILED = 2; 103 } 104 105 // The identity of the source that populated the `task_outcome_location`. 106 enum TaskOutcomeLocationSource { 107 // The task outcome before it is set. 108 TASK_OUTCOME_LOCATION_SOURCE_UNSPECIFIED = 0; 109 110 // The provider-specified the `task_outcome_location`. 111 PROVIDER = 2; 112 113 // The provider didn't specify the `task_outcome_location`, so Fleet Engine 114 // used the last known vehicle location. 115 LAST_VEHICLE_LOCATION = 3; 116 } 117 118 // Journey sharing specific fields. 119 message JourneySharingInfo { 120 // Tracking information for the stops that the assigned vehicle will make 121 // before it completes this Task. Note that this list can contain stops 122 // from other tasks. 123 // 124 // The first segment, 125 // `Task.journey_sharing_info.remaining_vehicle_journey_segments[0]` (gRPC) 126 // or `Task.journeySharingInfo.remainingVehicleJourneySegments[0]` (REST), 127 // contains route information from the driver's last known location to the 128 // upcoming `VehicleStop`. Current route information usually comes from the 129 // driver app, except for some cases noted in the documentation for 130 // [DeliveryVehicle.current_route_segment][maps.fleetengine.delivery.v1.DeliveryVehicle.current_route_segment]. 131 // The other segments in 132 // `Task.journey_sharing_info.remaining_vehicle_journey_segments` (gRPC) or 133 // `Task.journeySharingInfo.remainingVehicleJourneySegments` (REST) are 134 // populated by Fleet Engine. They provide route information between the 135 // remaining `VehicleStops`. 136 repeated VehicleJourneySegment remaining_vehicle_journey_segments = 1; 137 138 // Indicates the vehicle's last reported location of the assigned vehicle. 139 DeliveryVehicleLocation last_location = 2; 140 141 // Indicates whether the vehicle's lastLocation can be snapped to 142 // the `current_route_segment`. This value is False if either 143 // `last_location` or `current_route_segment` don't exist. This value is 144 // computed by Fleet Engine. Updates from clients are ignored. 145 bool last_location_snappable = 3; 146 } 147 148 // Must be in the format `providers/{provider}/tasks/{task}`. 149 string name = 1; 150 151 // Required. Immutable. Defines the type of the Task. For example, a break or 152 // shipment. 153 Type type = 2 [ 154 (google.api.field_behavior) = REQUIRED, 155 (google.api.field_behavior) = IMMUTABLE 156 ]; 157 158 // Required. The current execution state of the Task. 159 State state = 3 [(google.api.field_behavior) = REQUIRED]; 160 161 // The outcome of the Task. 162 TaskOutcome task_outcome = 9; 163 164 // The timestamp that indicates when the `Task`'s outcome was set by the 165 // provider. 166 google.protobuf.Timestamp task_outcome_time = 10; 167 168 // The location where the `Task`'s outcome was set. This value is updated as 169 // part of `UpdateTask`. If this value isn't explicitly updated by the 170 // provider, then Fleet Engine populates it by default with the last known 171 // vehicle location (the *raw* location). 172 LocationInfo task_outcome_location = 11; 173 174 // Indicates where the value of the `task_outcome_location` came from. 175 TaskOutcomeLocationSource task_outcome_location_source = 12; 176 177 // Immutable. This field facilitates the storing of an ID so you can avoid 178 // using a complicated mapping. You cannot set `tracking_id` for Tasks of type 179 // `UNAVAILABLE` and `SCHEDULED_STOP`. These IDs are subject to the 180 // following restrictions: 181 // 182 // * Must be a valid Unicode string. 183 // * Limited to a maximum length of 64 characters. 184 // * Normalized according to [Unicode Normalization Form C] 185 // (http://www.unicode.org/reports/tr15/). 186 // * May not contain any of the following ASCII characters: '/', ':', '?', 187 // ',', or '#'. 188 string tracking_id = 4 [(google.api.field_behavior) = IMMUTABLE]; 189 190 // Output only. The ID of the vehicle that is executing this Task. Delivery 191 // Vehicle IDs are subject to the following restrictions: 192 // 193 // * Must be a valid Unicode string. 194 // * Limited to a maximum length of 64 characters. 195 // * Normalized according to [Unicode Normalization Form C] 196 // (http://www.unicode.org/reports/tr15/). 197 // * May not contain any of the following ASCII characters: '/', ':', '?', 198 // ',', or '#'. 199 string delivery_vehicle_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; 200 201 // Immutable. The location where the Task will be completed. 202 // Optional for `UNAVAILABLE` Tasks, but required for all other Tasks. 203 LocationInfo planned_location = 6 [(google.api.field_behavior) = IMMUTABLE]; 204 205 // Required. Immutable. The time needed to execute a Task at this location. 206 google.protobuf.Duration task_duration = 7 [ 207 (google.api.field_behavior) = REQUIRED, 208 (google.api.field_behavior) = IMMUTABLE 209 ]; 210 211 // The time window during which the task should be completed. 212 TimeWindow target_time_window = 14; 213 214 // Output only. Journey sharing-specific fields. Not populated when state is 215 // `CLOSED`. 216 JourneySharingInfo journey_sharing_info = 8 217 [(google.api.field_behavior) = OUTPUT_ONLY]; 218 219 // The configuration for task tracking that specifies which data elements are 220 // visible to the end users under what circumstances. 221 TaskTrackingViewConfig task_tracking_view_config = 13; 222 223 // A list of custom Task attributes. Each attribute must have a unique key. 224 repeated TaskAttribute attributes = 15; 225} 226 227// The configuration message that defines when a data element of a Task should 228// be visible to the end users. 229message TaskTrackingViewConfig { 230 // The option message that defines when a data element should be visible to 231 // the end users. 232 message VisibilityOption { 233 // The specific visibility option chosen. 234 oneof visibility_option { 235 // This data element is visible to the end users if the remaining stop 236 // count <= remaining_stop_count_threshold. 237 int32 remaining_stop_count_threshold = 1; 238 239 // This data element is visible to the end users if the ETA to the stop 240 // <= duration_until_estimated_arrival_time_threshold. 241 google.protobuf.Duration duration_until_estimated_arrival_time_threshold = 242 2; 243 244 // This data element is visible to the end users if the remaining 245 // driving distance in meters <= 246 // remaining_driving_distance_meters_threshold. 247 int32 remaining_driving_distance_meters_threshold = 3; 248 249 // If set to true, this data element is always visible to the end users 250 // with no thresholds. This field cannot be set to false. 251 bool always = 4; 252 253 // If set to true, this data element is always hidden from the end users 254 // with no thresholds. This field cannot be set to false. 255 bool never = 5; 256 } 257 } 258 259 // The field that specifies when route polyline points can be visible. If this 260 // field is not specified, the project level default visibility configuration 261 // for this data will be used. 262 VisibilityOption route_polyline_points_visibility = 1; 263 264 // The field that specifies when estimated arrival time can be visible. If 265 // this field is not specified, the project level default visibility 266 // configuration for this data will be used. 267 VisibilityOption estimated_arrival_time_visibility = 2; 268 269 // The field that specifies when estimated task completion time can be 270 // visible. If this field is not specified, the project level default 271 // visibility configuration for this data will be used. 272 VisibilityOption estimated_task_completion_time_visibility = 3; 273 274 // The field that specifies when remaining driving distance can be visible. If 275 // this field is not specified, the project level default visibility 276 // configuration for this data will be used. 277 VisibilityOption remaining_driving_distance_visibility = 4; 278 279 // The field that specifies when remaining stop count can be visible. If this 280 // field is not specified, the project level default visibility configuration 281 // for this data will be used. 282 VisibilityOption remaining_stop_count_visibility = 5; 283 284 // The field that specifies when vehicle location can be visible. If this 285 // field is not specified, the project level default visibility configuration 286 // for this data will be used. 287 VisibilityOption vehicle_location_visibility = 6; 288} 289