<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/optimization/v1/fleet_routing.proto

namespace Google\Cloud\Optimization\V1\OptimizeToursResponse;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Overall metrics, aggregated over all routes.
 *
 * Generated from protobuf message <code>google.cloud.optimization.v1.OptimizeToursResponse.Metrics</code>
 */
class Metrics extends \Google\Protobuf\Internal\Message
{
    /**
     * Aggregated over the routes. Each metric is the sum (or max, for loads)
     * over all
     * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics]
     * fields of the same name.
     *
     * Generated from protobuf field <code>.google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1;</code>
     */
    private $aggregated_route_metrics = null;
    /**
     * Number of mandatory shipments skipped.
     *
     * Generated from protobuf field <code>int32 skipped_mandatory_shipment_count = 2;</code>
     */
    private $skipped_mandatory_shipment_count = 0;
    /**
     * Number of vehicles used. Note: if a vehicle route is empty and
     * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty]
     * is true, the vehicle is considered used.
     *
     * Generated from protobuf field <code>int32 used_vehicle_count = 3;</code>
     */
    private $used_vehicle_count = 0;
    /**
     * The earliest start time for a used vehicle, computed as the minimum over
     * all used vehicles of
     * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time].
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp earliest_vehicle_start_time = 4;</code>
     */
    private $earliest_vehicle_start_time = null;
    /**
     * The latest end time for a used vehicle, computed as the maximum over all
     * used vehicles of
     * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time].
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp latest_vehicle_end_time = 5;</code>
     */
    private $latest_vehicle_end_time = null;
    /**
     * Cost of the solution, broken down by cost-related request fields.
     * The keys are proto paths, relative to the input OptimizeToursRequest,
     * e.g. "model.shipments.pickups.cost", and the values are the total cost
     * generated by the corresponding cost field, aggregated over the whole
     * solution. In other words, costs["model.shipments.pickups.cost"] is the
     * sum of all pickup costs over the solution. All costs defined in the model
     * are reported in detail here with the exception of costs related to
     * TransitionAttributes that are only reported in an aggregated way as of
     * 2022/01.
     *
     * Generated from protobuf field <code>map<string, double> costs = 10;</code>
     */
    private $costs;
    /**
     * Total cost of the solution. The sum of all values in the costs map.
     *
     * Generated from protobuf field <code>double total_cost = 6;</code>
     */
    private $total_cost = 0.0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Optimization\V1\AggregatedMetrics $aggregated_route_metrics
     *           Aggregated over the routes. Each metric is the sum (or max, for loads)
     *           over all
     *           [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics]
     *           fields of the same name.
     *     @type int $skipped_mandatory_shipment_count
     *           Number of mandatory shipments skipped.
     *     @type int $used_vehicle_count
     *           Number of vehicles used. Note: if a vehicle route is empty and
     *           [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty]
     *           is true, the vehicle is considered used.
     *     @type \Google\Protobuf\Timestamp $earliest_vehicle_start_time
     *           The earliest start time for a used vehicle, computed as the minimum over
     *           all used vehicles of
     *           [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time].
     *     @type \Google\Protobuf\Timestamp $latest_vehicle_end_time
     *           The latest end time for a used vehicle, computed as the maximum over all
     *           used vehicles of
     *           [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time].
     *     @type array|\Google\Protobuf\Internal\MapField $costs
     *           Cost of the solution, broken down by cost-related request fields.
     *           The keys are proto paths, relative to the input OptimizeToursRequest,
     *           e.g. "model.shipments.pickups.cost", and the values are the total cost
     *           generated by the corresponding cost field, aggregated over the whole
     *           solution. In other words, costs["model.shipments.pickups.cost"] is the
     *           sum of all pickup costs over the solution. All costs defined in the model
     *           are reported in detail here with the exception of costs related to
     *           TransitionAttributes that are only reported in an aggregated way as of
     *           2022/01.
     *     @type float $total_cost
     *           Total cost of the solution. The sum of all values in the costs map.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Optimization\V1\FleetRouting::initOnce();
        parent::__construct($data);
    }

    /**
     * Aggregated over the routes. Each metric is the sum (or max, for loads)
     * over all
     * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics]
     * fields of the same name.
     *
     * Generated from protobuf field <code>.google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1;</code>
     * @return \Google\Cloud\Optimization\V1\AggregatedMetrics|null
     */
    public function getAggregatedRouteMetrics()
    {
        return $this->aggregated_route_metrics;
    }

    public function hasAggregatedRouteMetrics()
    {
        return isset($this->aggregated_route_metrics);
    }

    public function clearAggregatedRouteMetrics()
    {
        unset($this->aggregated_route_metrics);
    }

    /**
     * Aggregated over the routes. Each metric is the sum (or max, for loads)
     * over all
     * [ShipmentRoute.metrics][google.cloud.optimization.v1.ShipmentRoute.metrics]
     * fields of the same name.
     *
     * Generated from protobuf field <code>.google.cloud.optimization.v1.AggregatedMetrics aggregated_route_metrics = 1;</code>
     * @param \Google\Cloud\Optimization\V1\AggregatedMetrics $var
     * @return $this
     */
    public function setAggregatedRouteMetrics($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Optimization\V1\AggregatedMetrics::class);
        $this->aggregated_route_metrics = $var;

        return $this;
    }

    /**
     * Number of mandatory shipments skipped.
     *
     * Generated from protobuf field <code>int32 skipped_mandatory_shipment_count = 2;</code>
     * @return int
     */
    public function getSkippedMandatoryShipmentCount()
    {
        return $this->skipped_mandatory_shipment_count;
    }

    /**
     * Number of mandatory shipments skipped.
     *
     * Generated from protobuf field <code>int32 skipped_mandatory_shipment_count = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setSkippedMandatoryShipmentCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->skipped_mandatory_shipment_count = $var;

        return $this;
    }

    /**
     * Number of vehicles used. Note: if a vehicle route is empty and
     * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty]
     * is true, the vehicle is considered used.
     *
     * Generated from protobuf field <code>int32 used_vehicle_count = 3;</code>
     * @return int
     */
    public function getUsedVehicleCount()
    {
        return $this->used_vehicle_count;
    }

    /**
     * Number of vehicles used. Note: if a vehicle route is empty and
     * [Vehicle.used_if_route_is_empty][google.cloud.optimization.v1.Vehicle.used_if_route_is_empty]
     * is true, the vehicle is considered used.
     *
     * Generated from protobuf field <code>int32 used_vehicle_count = 3;</code>
     * @param int $var
     * @return $this
     */
    public function setUsedVehicleCount($var)
    {
        GPBUtil::checkInt32($var);
        $this->used_vehicle_count = $var;

        return $this;
    }

    /**
     * The earliest start time for a used vehicle, computed as the minimum over
     * all used vehicles of
     * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time].
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp earliest_vehicle_start_time = 4;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getEarliestVehicleStartTime()
    {
        return $this->earliest_vehicle_start_time;
    }

    public function hasEarliestVehicleStartTime()
    {
        return isset($this->earliest_vehicle_start_time);
    }

    public function clearEarliestVehicleStartTime()
    {
        unset($this->earliest_vehicle_start_time);
    }

    /**
     * The earliest start time for a used vehicle, computed as the minimum over
     * all used vehicles of
     * [ShipmentRoute.vehicle_start_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_start_time].
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp earliest_vehicle_start_time = 4;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setEarliestVehicleStartTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->earliest_vehicle_start_time = $var;

        return $this;
    }

    /**
     * The latest end time for a used vehicle, computed as the maximum over all
     * used vehicles of
     * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time].
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp latest_vehicle_end_time = 5;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getLatestVehicleEndTime()
    {
        return $this->latest_vehicle_end_time;
    }

    public function hasLatestVehicleEndTime()
    {
        return isset($this->latest_vehicle_end_time);
    }

    public function clearLatestVehicleEndTime()
    {
        unset($this->latest_vehicle_end_time);
    }

    /**
     * The latest end time for a used vehicle, computed as the maximum over all
     * used vehicles of
     * [ShipmentRoute.vehicle_end_time][google.cloud.optimization.v1.ShipmentRoute.vehicle_end_time].
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp latest_vehicle_end_time = 5;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setLatestVehicleEndTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->latest_vehicle_end_time = $var;

        return $this;
    }

    /**
     * Cost of the solution, broken down by cost-related request fields.
     * The keys are proto paths, relative to the input OptimizeToursRequest,
     * e.g. "model.shipments.pickups.cost", and the values are the total cost
     * generated by the corresponding cost field, aggregated over the whole
     * solution. In other words, costs["model.shipments.pickups.cost"] is the
     * sum of all pickup costs over the solution. All costs defined in the model
     * are reported in detail here with the exception of costs related to
     * TransitionAttributes that are only reported in an aggregated way as of
     * 2022/01.
     *
     * Generated from protobuf field <code>map<string, double> costs = 10;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getCosts()
    {
        return $this->costs;
    }

    /**
     * Cost of the solution, broken down by cost-related request fields.
     * The keys are proto paths, relative to the input OptimizeToursRequest,
     * e.g. "model.shipments.pickups.cost", and the values are the total cost
     * generated by the corresponding cost field, aggregated over the whole
     * solution. In other words, costs["model.shipments.pickups.cost"] is the
     * sum of all pickup costs over the solution. All costs defined in the model
     * are reported in detail here with the exception of costs related to
     * TransitionAttributes that are only reported in an aggregated way as of
     * 2022/01.
     *
     * Generated from protobuf field <code>map<string, double> costs = 10;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setCosts($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::DOUBLE);
        $this->costs = $arr;

        return $this;
    }

    /**
     * Total cost of the solution. The sum of all values in the costs map.
     *
     * Generated from protobuf field <code>double total_cost = 6;</code>
     * @return float
     */
    public function getTotalCost()
    {
        return $this->total_cost;
    }

    /**
     * Total cost of the solution. The sum of all values in the costs map.
     *
     * Generated from protobuf field <code>double total_cost = 6;</code>
     * @param float $var
     * @return $this
     */
    public function setTotalCost($var)
    {
        GPBUtil::checkDouble($var);
        $this->total_cost = $var;

        return $this;
    }

}


