# Google Cloud Optimization V1 Client - Class Reason (1.1.3)

1.1.3 (latest) 1.1.2 1.0.5 0.7.0 0.6.5 0.5.1 0.4.0 0.3.4 0.2.0 0.1.9 Reference documentation and code samples for the Google Cloud Optimization V1 Client class Reason.

If we can explain why the shipment was skipped, reasons will be listed
here. If the reason is not the same for all vehicles, `reason` will have
more than 1 element. A skipped shipment cannot have duplicate reasons,
i.e. where all fields are the same except for `example_vehicle_index`.

Example:

    reasons {
      code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
      example_vehicle_index: 1
      example_exceeded_capacity_type: "Apples"
    }
    reasons {
      code: DEMAND_EXCEEDS_VEHICLE_CAPACITY
      example_vehicle_index: 3
      example_exceeded_capacity_type: "Pears"
    }
    reasons {
      code: CANNOT_BE_PERFORMED_WITHIN_VEHICLE_DISTANCE_LIMIT
      example_vehicle_index: 1
    }

The skipped shipment is incompatible with all vehicles. The reasons may
be different for all vehicles but at least one vehicle's "Apples"
capacity would be exceeded (including vehicle 1), at least one vehicle's
"Pears" capacity would be exceeded (including vehicle 3) and at least one
vehicle's distance limit would be exceeded (including vehicle 1).

Generated from protobuf message `google.cloud.optimization.v1.SkippedShipment.Reason`

## Namespace

Google \\ Cloud \\ Optimization \\ V1 \\ SkippedShipment

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ code` | `int` Refer to the comments of Code. |
| `↳ example_vehicle_index` | `int` If the reason is related to a shipment-vehicle incompatibility, this field provides the index of one relevant vehicle. |
| `↳ example_exceeded_capacity_type` | `string` If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one capacity type that is exceeded. |

### getCode

Refer to the comments of Code.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [Code](https://docs.cloud.google.com/php/docs/reference/cloud-optimization/latest/V1.SkippedShipment.Reason.Code). |

### setCode

Refer to the comments of Code.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [Code](https://docs.cloud.google.com/php/docs/reference/cloud-optimization/latest/V1.SkippedShipment.Reason.Code). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExampleVehicleIndex

If the reason is related to a shipment-vehicle incompatibility, this
field provides the index of one relevant vehicle.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasExampleVehicleIndex

### clearExampleVehicleIndex

### setExampleVehicleIndex

If the reason is related to a shipment-vehicle incompatibility, this
field provides the index of one relevant vehicle.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExampleExceededCapacityType

If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one
capacity type that is exceeded.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setExampleExceededCapacityType

If the reason code is `DEMAND_EXCEEDS_VEHICLE_CAPACITY`, documents one
capacity type that is exceeded.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |