<?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 [deprecated = true];</code>
     */
    const PREEMPTIBLE = 3;
    /**
     * Bound to the lifecycle of the reservation in which it is provisioned.
     *
     * Generated from protobuf enum <code>RESERVATION_BOUND = 4;</code>
     */
    const RESERVATION_BOUND = 4;
    /**
     * Instance is provisioned with DWS Flex Start and has limited max run
     * duration.
     *
     * Generated from protobuf enum <code>FLEX_START = 5;</code>
     */
    const FLEX_START = 5;

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

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

