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

namespace Google\Cloud\NetworkConnectivity\V1\InternalRange;

use UnexpectedValueException;

/**
 * Possible usage of an internal range.
 *
 * Protobuf type <code>google.cloud.networkconnectivity.v1.InternalRange.Usage</code>
 */
class Usage
{
    /**
     * Unspecified usage is allowed in calls which identify the resource by
     * other fields and do not need Usage set to complete. These are, i.e.:
     * GetInternalRange and DeleteInternalRange.
     * Usage needs to be specified explicitly in CreateInternalRange
     * or UpdateInternalRange calls.
     *
     * Generated from protobuf enum <code>USAGE_UNSPECIFIED = 0;</code>
     */
    const USAGE_UNSPECIFIED = 0;
    /**
     * A VPC resource can use the reserved CIDR block by associating it with the
     * internal range resource if usage is set to FOR_VPC.
     *
     * Generated from protobuf enum <code>FOR_VPC = 1;</code>
     */
    const FOR_VPC = 1;
    /**
     * Ranges created with EXTERNAL_TO_VPC cannot be associated with VPC
     * resources and are meant to block out address ranges for various use
     * cases, like for example, usage on-prem, with dynamic route announcements
     * via interconnect.
     *
     * Generated from protobuf enum <code>EXTERNAL_TO_VPC = 2;</code>
     */
    const EXTERNAL_TO_VPC = 2;
    /**
     * Ranges created FOR_MIGRATION can be used to lock a CIDR range between a
     * source and target subnet. If usage is set to FOR_MIGRATION, the peering
     * value has to be set to FOR_SELF or default to FOR_SELF when unset.
     *
     * Generated from protobuf enum <code>FOR_MIGRATION = 3;</code>
     */
    const FOR_MIGRATION = 3;

    private static $valueToName = [
        self::USAGE_UNSPECIFIED => 'USAGE_UNSPECIFIED',
        self::FOR_VPC => 'FOR_VPC',
        self::EXTERNAL_TO_VPC => 'EXTERNAL_TO_VPC',
        self::FOR_MIGRATION => 'FOR_MIGRATION',
    ];

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


