<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/bigtable/admin/v2/instance.proto

namespace Google\Cloud\Bigtable\Admin\V2\Cluster;

use UnexpectedValueException;

/**
 * Possible states of a cluster.
 *
 * Protobuf type <code>google.bigtable.admin.v2.Cluster.State</code>
 */
class State
{
    /**
     * The state of the cluster could not be determined.
     *
     * Generated from protobuf enum <code>STATE_NOT_KNOWN = 0;</code>
     */
    const STATE_NOT_KNOWN = 0;
    /**
     * The cluster has been successfully created and is ready to serve requests.
     *
     * Generated from protobuf enum <code>READY = 1;</code>
     */
    const READY = 1;
    /**
     * The cluster is currently being created, and may be destroyed
     * if the creation process encounters an error.
     * A cluster may not be able to serve requests while being created.
     *
     * Generated from protobuf enum <code>CREATING = 2;</code>
     */
    const CREATING = 2;
    /**
     * The cluster is currently being resized, and may revert to its previous
     * node count if the process encounters an error.
     * A cluster is still capable of serving requests while being resized,
     * but may exhibit performance as if its number of allocated nodes is
     * between the starting and requested states.
     *
     * Generated from protobuf enum <code>RESIZING = 3;</code>
     */
    const RESIZING = 3;
    /**
     * The cluster has no backing nodes. The data (tables) still
     * exist, but no operations can be performed on the cluster.
     *
     * Generated from protobuf enum <code>DISABLED = 4;</code>
     */
    const DISABLED = 4;

    private static $valueToName = [
        self::STATE_NOT_KNOWN => 'STATE_NOT_KNOWN',
        self::READY => 'READY',
        self::CREATING => 'CREATING',
        self::RESIZING => 'RESIZING',
        self::DISABLED => 'DISABLED',
    ];

    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(State::class, \Google\Cloud\Bigtable\Admin\V2\Cluster_State::class);

