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

namespace Google\Cloud\Shell\V1\Environment;

use UnexpectedValueException;

/**
 * Possible execution states for an environment.
 *
 * Protobuf type <code>google.cloud.shell.v1.Environment.State</code>
 */
class State
{
    /**
     * The environment's states is unknown.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The environment is not running and can't be connected to. Starting the
     * environment will transition it to the PENDING state.
     *
     * Generated from protobuf enum <code>SUSPENDED = 1;</code>
     */
    const SUSPENDED = 1;
    /**
     * The environment is being started but is not yet ready to accept
     * connections.
     *
     * Generated from protobuf enum <code>PENDING = 2;</code>
     */
    const PENDING = 2;
    /**
     * The environment is running and ready to accept connections. It will
     * automatically transition back to DISABLED after a period of inactivity or
     * if another environment is started.
     *
     * Generated from protobuf enum <code>RUNNING = 3;</code>
     */
    const RUNNING = 3;
    /**
     * The environment is being deleted and can't be connected to.
     *
     * Generated from protobuf enum <code>DELETING = 4;</code>
     */
    const DELETING = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::SUSPENDED => 'SUSPENDED',
        self::PENDING => 'PENDING',
        self::RUNNING => 'RUNNING',
        self::DELETING => 'DELETING',
    ];

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


