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

namespace Google\Cloud\NetworkConnectivity\V1\ServiceConnectionMap\ConsumerPscConnection;

use UnexpectedValueException;

/**
 * The state of the PSC connection.
 * We reserve the right to add more states without notice in the future.
 * Users should not use exhaustive switch statements on this enum.
 * See https://google.aip.dev/216.
 *
 * Protobuf type <code>google.cloud.networkconnectivity.v1.ServiceConnectionMap.ConsumerPscConnection.State</code>
 */
class State
{
    /**
     * An invalid state as the default case.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The connection has been created successfully. However, for the
     * up-to-date connection status, please use the service attachment's
     * "ConnectedEndpoint.status" as the source of truth.
     *
     * Generated from protobuf enum <code>ACTIVE = 1;</code>
     */
    const ACTIVE = 1;
    /**
     * The connection is not functional since some resources on the connection
     * fail to be created.
     *
     * Generated from protobuf enum <code>FAILED = 2;</code>
     */
    const FAILED = 2;
    /**
     * The connection is being created.
     *
     * Generated from protobuf enum <code>CREATING = 3;</code>
     */
    const CREATING = 3;
    /**
     * The connection is being deleted.
     *
     * Generated from protobuf enum <code>DELETING = 4;</code>
     */
    const DELETING = 4;
    /**
     * The connection is being repaired to complete creation.
     *
     * Generated from protobuf enum <code>CREATE_REPAIRING = 5;</code>
     */
    const CREATE_REPAIRING = 5;
    /**
     * The connection is being repaired to complete deletion.
     *
     * Generated from protobuf enum <code>DELETE_REPAIRING = 6;</code>
     */
    const DELETE_REPAIRING = 6;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::ACTIVE => 'ACTIVE',
        self::FAILED => 'FAILED',
        self::CREATING => 'CREATING',
        self::DELETING => 'DELETING',
        self::CREATE_REPAIRING => 'CREATE_REPAIRING',
        self::DELETE_REPAIRING => 'DELETE_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);
    }
}


