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

namespace Google\Cloud\Datastream\V1\PrivateConnection;

use UnexpectedValueException;

/**
 * Private Connection state.
 *
 * Protobuf type <code>google.cloud.datastream.v1.PrivateConnection.State</code>
 */
class State
{
    /**
     * Unspecified state.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The private connection is in creation state - creating resources.
     *
     * Generated from protobuf enum <code>CREATING = 1;</code>
     */
    const CREATING = 1;
    /**
     * The private connection has been created with all of its resources.
     *
     * Generated from protobuf enum <code>CREATED = 2;</code>
     */
    const CREATED = 2;
    /**
     * The private connection creation has failed.
     *
     * Generated from protobuf enum <code>FAILED = 3;</code>
     */
    const FAILED = 3;
    /**
     * The private connection is being deleted.
     *
     * Generated from protobuf enum <code>DELETING = 4;</code>
     */
    const DELETING = 4;
    /**
     * Delete request has failed, resource is in invalid state.
     *
     * Generated from protobuf enum <code>FAILED_TO_DELETE = 5;</code>
     */
    const FAILED_TO_DELETE = 5;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::CREATING => 'CREATING',
        self::CREATED => 'CREATED',
        self::FAILED => 'FAILED',
        self::DELETING => 'DELETING',
        self::FAILED_TO_DELETE => 'FAILED_TO_DELETE',
    ];

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

