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

namespace Google\Cloud\Compute\V1\NetworkPeering;

use UnexpectedValueException;

/**
 * The update strategy determines the semantics for updates and deletes to the
 * peering connection configuration.
 *
 * Protobuf type <code>google.cloud.compute.v1.NetworkPeering.UpdateStrategy</code>
 */
class UpdateStrategy
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_UPDATE_STRATEGY = 0;</code>
     */
    const UNDEFINED_UPDATE_STRATEGY = 0;
    /**
     * Updates are reflected in the local peering but aren't applied to the
     * peering connection until a complementary change is made to the
     * matching peering.
     * To delete a peering with the consensus update strategy, both the peerings
     * must request the deletion of the peering before the peering can be
     * deleted.
     *
     * Generated from protobuf enum <code>CONSENSUS = 203373655;</code>
     */
    const CONSENSUS = 203373655;
    /**
     * In this mode, changes to the peering configuration can
     * be unilaterally altered by changing either side of the peering.
     * This is the default value if the field is unspecified.
     *
     * Generated from protobuf enum <code>INDEPENDENT = 127011674;</code>
     */
    const INDEPENDENT = 127011674;
    /**
     * Peerings with update strategy UNSPECIFIED are created with
     * update strategy INDEPENDENT.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 526786327;</code>
     */
    const UNSPECIFIED = 526786327;

    private static $valueToName = [
        self::UNDEFINED_UPDATE_STRATEGY => 'UNDEFINED_UPDATE_STRATEGY',
        self::CONSENSUS => 'CONSENSUS',
        self::INDEPENDENT => 'INDEPENDENT',
        self::UNSPECIFIED => 'UNSPECIFIED',
    ];

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

