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

namespace Google\Cloud\Batch\V1\AllocationPolicy;

use UnexpectedValueException;

/**
 * Compute Engine VM instance provisioning model.
 *
 * Protobuf type <code>google.cloud.batch.v1.AllocationPolicy.ProvisioningModel</code>
 */
class ProvisioningModel
{
    /**
     * Unspecified.
     *
     * Generated from protobuf enum <code>PROVISIONING_MODEL_UNSPECIFIED = 0;</code>
     */
    const PROVISIONING_MODEL_UNSPECIFIED = 0;
    /**
     * Standard VM.
     *
     * Generated from protobuf enum <code>STANDARD = 1;</code>
     */
    const STANDARD = 1;
    /**
     * SPOT VM.
     *
     * Generated from protobuf enum <code>SPOT = 2;</code>
     */
    const SPOT = 2;
    /**
     * Preemptible VM (PVM).
     * Above SPOT VM is the preferable model for preemptible VM instances: the
     * old preemptible VM model (indicated by this field) is the older model,
     * and has been migrated to use the SPOT model as the underlying technology.
     * This old model will still be supported.
     *
     * Generated from protobuf enum <code>PREEMPTIBLE = 3;</code>
     */
    const PREEMPTIBLE = 3;

    private static $valueToName = [
        self::PROVISIONING_MODEL_UNSPECIFIED => 'PROVISIONING_MODEL_UNSPECIFIED',
        self::STANDARD => 'STANDARD',
        self::SPOT => 'SPOT',
        self::PREEMPTIBLE => 'PREEMPTIBLE',
    ];

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


