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

namespace Couchbase\Protostellar\Generated\Admin\Query\V1;

use UnexpectedValueException;

/**
 * Protobuf type <code>couchbase.admin.query.v1.IndexState</code>
 */
class IndexState
{
    /**
     * Generated from protobuf enum <code>INDEX_STATE_DEFERRED = 0;</code>
     */
    const INDEX_STATE_DEFERRED = 0;
    /**
     * Generated from protobuf enum <code>INDEX_STATE_BUILDING = 1;</code>
     */
    const INDEX_STATE_BUILDING = 1;
    /**
     * Generated from protobuf enum <code>INDEX_STATE_PENDING = 2;</code>
     */
    const INDEX_STATE_PENDING = 2;
    /**
     * Generated from protobuf enum <code>INDEX_STATE_ONLINE = 3;</code>
     */
    const INDEX_STATE_ONLINE = 3;
    /**
     * Generated from protobuf enum <code>INDEX_STATE_OFFLINE = 4;</code>
     */
    const INDEX_STATE_OFFLINE = 4;
    /**
     * Generated from protobuf enum <code>INDEX_STATE_ABRIDGED = 5;</code>
     */
    const INDEX_STATE_ABRIDGED = 5;
    /**
     * Generated from protobuf enum <code>INDEX_STATE_SCHEDULED = 6;</code>
     */
    const INDEX_STATE_SCHEDULED = 6;

    private static $valueToName = [
        self::INDEX_STATE_DEFERRED => 'INDEX_STATE_DEFERRED',
        self::INDEX_STATE_BUILDING => 'INDEX_STATE_BUILDING',
        self::INDEX_STATE_PENDING => 'INDEX_STATE_PENDING',
        self::INDEX_STATE_ONLINE => 'INDEX_STATE_ONLINE',
        self::INDEX_STATE_OFFLINE => 'INDEX_STATE_OFFLINE',
        self::INDEX_STATE_ABRIDGED => 'INDEX_STATE_ABRIDGED',
        self::INDEX_STATE_SCHEDULED => 'INDEX_STATE_SCHEDULED',
    ];

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

