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

namespace Google\Cloud\NetworkConnectivity\V1\PolicyBasedRoute\Warnings;

use UnexpectedValueException;

/**
 * Warning code for Policy Based Routing. Expect to add values in the
 * future.
 *
 * Protobuf type <code>google.cloud.networkconnectivity.v1.PolicyBasedRoute.Warnings.Code</code>
 */
class Code
{
    /**
     * Default value.
     *
     * Generated from protobuf enum <code>WARNING_UNSPECIFIED = 0;</code>
     */
    const WARNING_UNSPECIFIED = 0;
    /**
     * The policy based route is not active and functioning. Common causes are
     * the dependent network was deleted or the resource project was turned
     * off.
     *
     * Generated from protobuf enum <code>RESOURCE_NOT_ACTIVE = 1;</code>
     */
    const RESOURCE_NOT_ACTIVE = 1;
    /**
     * The policy based route is being modified (e.g. created/deleted) at this
     * time.
     *
     * Generated from protobuf enum <code>RESOURCE_BEING_MODIFIED = 2;</code>
     */
    const RESOURCE_BEING_MODIFIED = 2;

    private static $valueToName = [
        self::WARNING_UNSPECIFIED => 'WARNING_UNSPECIFIED',
        self::RESOURCE_NOT_ACTIVE => 'RESOURCE_NOT_ACTIVE',
        self::RESOURCE_BEING_MODIFIED => 'RESOURCE_BEING_MODIFIED',
    ];

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


