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

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

use UnexpectedValueException;

/**
 * Possible states of a snapshot.
 *
 * Protobuf type <code>google.bigtable.admin.v2.Snapshot.State</code>
 */
class State
{
    /**
     * The state of the snapshot could not be determined.
     *
     * Generated from protobuf enum <code>STATE_NOT_KNOWN = 0;</code>
     */
    const STATE_NOT_KNOWN = 0;
    /**
     * The snapshot has been successfully created and can serve all requests.
     *
     * Generated from protobuf enum <code>READY = 1;</code>
     */
    const READY = 1;
    /**
     * The snapshot is currently being created, and may be destroyed if the
     * creation process encounters an error. A snapshot may not be restored to a
     * table while it is being created.
     *
     * Generated from protobuf enum <code>CREATING = 2;</code>
     */
    const CREATING = 2;

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

    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\Snapshot_State::class);

