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

namespace Google\Cloud\Compute\V1\InstanceGroupManagerUpdatePolicy;

use UnexpectedValueException;

/**
 * What action should be used to replace instances. See minimal_action.REPLACE
 *
 * Protobuf type <code>google.cloud.compute.v1.InstanceGroupManagerUpdatePolicy.ReplacementMethod</code>
 */
class ReplacementMethod
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_REPLACEMENT_METHOD = 0;</code>
     */
    const UNDEFINED_REPLACEMENT_METHOD = 0;
    /**
     * Instances will be recreated (with the same name)
     *
     * Generated from protobuf enum <code>RECREATE = 522644719;</code>
     */
    const RECREATE = 522644719;
    /**
     * Default option: instances will be deleted and created (with a new name)
     *
     * Generated from protobuf enum <code>SUBSTITUTE = 280924314;</code>
     */
    const SUBSTITUTE = 280924314;

    private static $valueToName = [
        self::UNDEFINED_REPLACEMENT_METHOD => 'UNDEFINED_REPLACEMENT_METHOD',
        self::RECREATE => 'RECREATE',
        self::SUBSTITUTE => 'SUBSTITUTE',
    ];

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


