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

namespace Google\Cloud\Spanner\V1\PlanNode;

use UnexpectedValueException;

/**
 * The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes between the two different kinds of
 * nodes that can appear in a query plan.
 *
 * Protobuf type <code>google.spanner.v1.PlanNode.Kind</code>
 */
class Kind
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>KIND_UNSPECIFIED = 0;</code>
     */
    const KIND_UNSPECIFIED = 0;
    /**
     * Denotes a Relational operator node in the expression tree. Relational
     * operators represent iterative processing of rows during query execution.
     * For example, a `TableScan` operation that reads rows from a table.
     *
     * Generated from protobuf enum <code>RELATIONAL = 1;</code>
     */
    const RELATIONAL = 1;
    /**
     * Denotes a Scalar node in the expression tree. Scalar nodes represent
     * non-iterable entities in the query plan. For example, constants or
     * arithmetic operators appearing inside predicate expressions or references
     * to column names.
     *
     * Generated from protobuf enum <code>SCALAR = 2;</code>
     */
    const SCALAR = 2;

    private static $valueToName = [
        self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED',
        self::RELATIONAL => 'RELATIONAL',
        self::SCALAR => 'SCALAR',
    ];

    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(Kind::class, \Google\Cloud\Spanner\V1\PlanNode_Kind::class);

