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

namespace Google\Cloud\Datastore\Admin\V1\Index;

use UnexpectedValueException;

/**
 * For an ordered index, specifies whether each of the entity's ancestors
 * will be included.
 *
 * Protobuf type <code>google.datastore.admin.v1.Index.AncestorMode</code>
 */
class AncestorMode
{
    /**
     * The ancestor mode is unspecified.
     *
     * Generated from protobuf enum <code>ANCESTOR_MODE_UNSPECIFIED = 0;</code>
     */
    const ANCESTOR_MODE_UNSPECIFIED = 0;
    /**
     * Do not include the entity's ancestors in the index.
     *
     * Generated from protobuf enum <code>NONE = 1;</code>
     */
    const NONE = 1;
    /**
     * Include all the entity's ancestors in the index.
     *
     * Generated from protobuf enum <code>ALL_ANCESTORS = 2;</code>
     */
    const ALL_ANCESTORS = 2;

    private static $valueToName = [
        self::ANCESTOR_MODE_UNSPECIFIED => 'ANCESTOR_MODE_UNSPECIFIED',
        self::NONE => 'NONE',
        self::ALL_ANCESTORS => 'ALL_ANCESTORS',
    ];

    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(AncestorMode::class, \Google\Cloud\Datastore\Admin\V1\Index_AncestorMode::class);

