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

namespace Google\Maps\RouteOptimization\V1\OptimizeToursRequest;

use UnexpectedValueException;

/**
 * Mode defining the behavior of the search, trading off latency versus
 * solution quality. In all modes, the global request deadline is enforced.
 *
 * Protobuf type <code>google.maps.routeoptimization.v1.OptimizeToursRequest.SearchMode</code>
 */
class SearchMode
{
    /**
     * Unspecified search mode, equivalent to `RETURN_FAST`.
     *
     * Generated from protobuf enum <code>SEARCH_MODE_UNSPECIFIED = 0;</code>
     */
    const SEARCH_MODE_UNSPECIFIED = 0;
    /**
     * Stop the search after finding the first good solution.
     *
     * Generated from protobuf enum <code>RETURN_FAST = 1;</code>
     */
    const RETURN_FAST = 1;
    /**
     * Spend all the available time to search for better solutions.
     *
     * Generated from protobuf enum <code>CONSUME_ALL_AVAILABLE_TIME = 2;</code>
     */
    const CONSUME_ALL_AVAILABLE_TIME = 2;

    private static $valueToName = [
        self::SEARCH_MODE_UNSPECIFIED => 'SEARCH_MODE_UNSPECIFIED',
        self::RETURN_FAST => 'RETURN_FAST',
        self::CONSUME_ALL_AVAILABLE_TIME => 'CONSUME_ALL_AVAILABLE_TIME',
    ];

    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)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}


