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

namespace Google\Cloud\VMMigration\V1\DatacenterConnector;

use UnexpectedValueException;

/**
 * The possible values of the state.
 *
 * Protobuf type <code>google.cloud.vmmigration.v1.DatacenterConnector.State</code>
 */
class State
{
    /**
     * The state is unknown. This is used for API compatibility only and is not
     * used by the system.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The state was not sampled by the health checks yet.
     *
     * Generated from protobuf enum <code>PENDING = 1;</code>
     */
    const PENDING = 1;
    /**
     * The source was sampled by health checks and is not available.
     *
     * Generated from protobuf enum <code>OFFLINE = 2;</code>
     */
    const OFFLINE = 2;
    /**
     * The source is available but might not be usable yet due to unvalidated
     * credentials or another reason. The credentials referred to are the ones
     * to the Source. The error message will contain further details.
     *
     * Generated from protobuf enum <code>FAILED = 3;</code>
     */
    const FAILED = 3;
    /**
     * The source exists and its credentials were verified.
     *
     * Generated from protobuf enum <code>ACTIVE = 4;</code>
     */
    const ACTIVE = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::PENDING => 'PENDING',
        self::OFFLINE => 'OFFLINE',
        self::FAILED => 'FAILED',
        self::ACTIVE => 'ACTIVE',
    ];

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


