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

namespace Google\Cloud\Spanner\V1\ExecuteSqlRequest;

use UnexpectedValueException;

/**
 * Mode in which the statement must be processed.
 *
 * Protobuf type <code>google.spanner.v1.ExecuteSqlRequest.QueryMode</code>
 */
class QueryMode
{
    /**
     * The default mode. Only the statement 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);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(QueryMode::class, \Google\Cloud\Spanner\V1\ExecuteSqlRequest_QueryMode::class);

