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

namespace Google\Cloud\Datastore\V1;

use UnexpectedValueException;

/**
 * The mode in which the query request must be processed.
 *
 * Protobuf type <code>google.datastore.v1.QueryMode</code>
 */
class QueryMode
{
    /**
     * The default mode. Only the query results are returned.
     *
     * Generated from protobuf enum <code>NORMAL = 0;</code>
     */
    const NORMAL = 0;
    /**
     * This mode returns only the query plan, without any results or execution
     * statistics information.
     *
     * Generated from protobuf enum <code>PLAN = 1;</code>
     */
    const PLAN = 1;
    /**
     * This mode returns both the query plan and the execution statistics along
     * with the results.
     *
     * Generated from protobuf enum <code>PROFILE = 2;</code>
     */
    const PROFILE = 2;

    private static $valueToName = [
        self::NORMAL => 'NORMAL',
        self::PLAN => 'PLAN',
        self::PROFILE => 'PROFILE',
    ];

    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);
    }
}

