# VehicleJourneySegment

- [JSON representation](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#SCHEMA_REPRESENTATION)
- [VehicleStop](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#VehicleStop)
  - [JSON representation](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#VehicleStop.SCHEMA_REPRESENTATION)
- [TaskInfo](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#TaskInfo)
  - [JSON representation](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#TaskInfo.SCHEMA_REPRESENTATION)
- [State](https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#State)

Represents a Vehicle's travel segment - from its previous stop to the current stop. If it is the first active stop, then it is from the Vehicle's current location to this stop.

| JSON representation |
|---|
| ``` { "stop": { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#VehicleStop`) }, "drivingDistanceMeters": integer, "drivingDuration": string, "path": [ { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LatLng`) } ] } ``` |

| Fields ||
|---|---|
| `stop` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#VehicleStop`)`` Specifies the stop location, along with the `Task`s associated with the stop. Some fields of the VehicleStop might not be present if this journey segment is part of `JourneySharingInfo`. |
| `drivingDistanceMeters` | `integer` Output only. The travel distance from the previous stop to this stop. If the current stop is the first stop in the list of journey segments, then the starting point is the vehicle's location recorded at the time that this stop was added to the list. This field might not be present if this journey segment is part of `JourneySharingInfo`. |
| `drivingDuration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Output only. The travel time from the previous stop to this stop. If the current stop is the first stop in the list of journey segments, then the starting point is the Vehicle's location recorded at the time that this stop was added to the list. If this field is defined in the path `Task.remaining_vehicle_journey_segments[0].driving_duration` (gRPC) or `Task.remainingVehicleJourneySegments[0].drivingDuration` (REST), then it may be populated with the value from `DeliveryVehicle.remaining_duration` (gRPC) or `DeliveryVehicle.remainingDuration` (REST). This provides the remaining driving duration from the driver app's latest known location rather than the driving time from the previous stop. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `path[]` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LatLng`)`` Output only. The path from the previous stop to this stop. If the current stop is the first stop in the list of journey segments, then this is the path from the vehicle's current location to this stop at the time that the stop was added to the list. This field might not be present if this journey segment is part of `JourneySharingInfo`. If this field is defined in the path `Task.journey_sharing_info.remaining_vehicle_journey_segments[0].path` (gRPC) or `Task.journeySharingInfo.remainingVehicleJourneySegments[0].path` (REST), then it may be populated with the `LatLng`s decoded from `DeliveryVehicle.current_route_segment` (gRPC) or `DeliveryVehicle.currentRouteSegment` (REST). This provides the driving path from the driver app's latest known location rather than the path from the previous stop. |

## VehicleStop

Describes a point where a Vehicle stops to perform one or more `Task`s.

| JSON representation |
|---|
| ``` { "plannedLocation": { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LocationInfo`) }, "tasks": [ { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#TaskInfo`) } ], "state": enum (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#State`) } ``` |

| Fields ||
|---|---|
| `plannedLocation` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/LocationInfo`)`` Required. The location of the stop. Note that the locations in the `Task`s might not exactly match this location, but will be within a short distance of it. This field won't be populated in the response of a `tasks.get` call. |
| `tasks[]` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#TaskInfo`)`` The list of `Task`s to be performed at this stop. This field won't be populated in the response of a `tasks.get` call. |
| `state` | ``enum (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/VehicleJourneySegment#State`)`` The state of the `VehicleStop`. This field won't be populated in the response of a `tasks.get` call. |

## TaskInfo

Additional information about the Task performed at this stop.

| JSON representation |
|---|
| ``` { "taskId": string, "taskDuration": string, "targetTimeWindow": { object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/TimeWindow`) } } ``` |

| Fields ||
|---|---|
| `taskId` | `string` The Task ID. This field won't be populated in the response of a `tasks.get` call. Task IDs are subject to the following restrictions: - Must be a valid Unicode string. - Limited to a maximum length of 64 characters. - Normalized according to [Unicode Normalization Form C](http://www.unicode.org/reports/tr15/). - May not contain any of the following ASCII characters: '/', ':', '?', ',', or '#'. |
| `taskDuration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Output only. The time required to perform the Task. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `targetTimeWindow` | ``object (`https://developers.google.com/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/TimeWindow`)`` Output only. The time window during which the task should be completed. This is only set in the response to `deliveryVehicles.get`. |

## State

The current state of a `VehicleStop`.

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | Unknown. |
| `NEW` | Created, but not actively routing. |
| `ENROUTE` | Assigned and actively routing. |
| `ARRIVED` | Arrived at stop. Assumes that when the Vehicle is routing to the next stop, that all previous stops have been completed. |