<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/maps/routeoptimization/v1/route_optimization_service.proto

namespace Google\Maps\RouteOptimization\V1\ShipmentModel\Objective;

use UnexpectedValueException;

/**
 * The objective type that will be mapped to a set of costs.
 *
 * Protobuf type <code>google.maps.routeoptimization.v1.ShipmentModel.Objective.Type</code>
 */
class Type
{
    /**
     * A default set of costs will be used, to ensure a reasonable solution.
     * Note: this objective can be used on its own, but will also always be
     * added with weight 1.0, as a baseline, to the objectives specified by
     * the user, if it's not already present.
     *
     * Generated from protobuf enum <code>DEFAULT = 0;</code>
     */
    const PBDEFAULT = 0;
    /**
     * "MIN" objectives.
     * Minimize the total distance traveled.
     *
     * Generated from protobuf enum <code>MIN_DISTANCE = 10;</code>
     */
    const MIN_DISTANCE = 10;
    /**
     * Minimize the total working time, summed over all vehicles.
     *
     * Generated from protobuf enum <code>MIN_WORKING_TIME = 11;</code>
     */
    const MIN_WORKING_TIME = 11;
    /**
     * Same as above but focusing on travel time only.
     *
     * Generated from protobuf enum <code>MIN_TRAVEL_TIME = 12;</code>
     */
    const MIN_TRAVEL_TIME = 12;
    /**
     * Minimize the number of vehicles used.
     *
     * Generated from protobuf enum <code>MIN_NUM_VEHICLES = 13;</code>
     */
    const MIN_NUM_VEHICLES = 13;

    private static $valueToName = [
        self::PBDEFAULT => 'DEFAULT',
        self::MIN_DISTANCE => 'MIN_DISTANCE',
        self::MIN_WORKING_TIME => 'MIN_WORKING_TIME',
        self::MIN_TRAVEL_TIME => 'MIN_TRAVEL_TIME',
        self::MIN_NUM_VEHICLES => 'MIN_NUM_VEHICLES',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}


