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

namespace Google\Cloud\ApigeeRegistry\V1\Instance;

use UnexpectedValueException;

/**
 * State of the Instance.
 *
 * Protobuf type <code>google.cloud.apigeeregistry.v1.Instance.State</code>
 */
class State
{
    /**
     * The default value. This value is used if the state is omitted.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The Instance has not been initialized or has been deleted.
     *
     * Generated from protobuf enum <code>INACTIVE = 1;</code>
     */
    const INACTIVE = 1;
    /**
     * The Instance is being created.
     *
     * Generated from protobuf enum <code>CREATING = 2;</code>
     */
    const CREATING = 2;
    /**
     * The Instance has been created and is ready for use.
     *
     * Generated from protobuf enum <code>ACTIVE = 3;</code>
     */
    const ACTIVE = 3;
    /**
     * The Instance is being updated.
     *
     * Generated from protobuf enum <code>UPDATING = 4;</code>
     */
    const UPDATING = 4;
    /**
     * The Instance is being deleted.
     *
     * Generated from protobuf enum <code>DELETING = 5;</code>
     */
    const DELETING = 5;
    /**
     * The Instance encountered an error during a state change.
     *
     * Generated from protobuf enum <code>FAILED = 6;</code>
     */
    const FAILED = 6;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::INACTIVE => 'INACTIVE',
        self::CREATING => 'CREATING',
        self::ACTIVE => 'ACTIVE',
        self::UPDATING => 'UPDATING',
        self::DELETING => 'DELETING',
        self::FAILED => 'FAILED',
    ];

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


