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

namespace Google\Cloud\LicenseManager\V1\Instance;

use UnexpectedValueException;

/**
 * VM status enum.
 *
 * Protobuf type <code>google.cloud.licensemanager.v1.Instance.State</code>
 */
class State
{
    /**
     * The Status of the VM is unspecified.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Resources are being allocated for the instance.
     *
     * Generated from protobuf enum <code>PROVISIONING = 1;</code>
     */
    const PROVISIONING = 1;
    /**
     * All required resources have been allocated and
     * the instance is being started.
     *
     * Generated from protobuf enum <code>STAGING = 2;</code>
     */
    const STAGING = 2;
    /**
     * The instance is running.
     *
     * Generated from protobuf enum <code>RUNNING = 3;</code>
     */
    const RUNNING = 3;
    /**
     * The instance is currently stopping (either being deleted or terminated).
     *
     * Generated from protobuf enum <code>STOPPING = 4;</code>
     */
    const STOPPING = 4;
    /**
     * The instance has stopped due to various reasons (user request, VM
     * preemption, project freezing, etc.).
     *
     * Generated from protobuf enum <code>STOPPED = 5;</code>
     */
    const STOPPED = 5;
    /**
     * The instance has failed in some way.
     *
     * Generated from protobuf enum <code>TERMINATED = 6;</code>
     */
    const TERMINATED = 6;
    /**
     * The instance is in repair.
     *
     * Generated from protobuf enum <code>REPAIRING = 7;</code>
     */
    const REPAIRING = 7;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::PROVISIONING => 'PROVISIONING',
        self::STAGING => 'STAGING',
        self::RUNNING => 'RUNNING',
        self::STOPPING => 'STOPPING',
        self::STOPPED => 'STOPPED',
        self::TERMINATED => 'TERMINATED',
        self::REPAIRING => 'REPAIRING',
    ];

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


