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

namespace Google\Cloud\Dataproc\V1\ReservationAffinity;

use UnexpectedValueException;

/**
 * Indicates whether to consume capacity from an reservation or not.
 *
 * Protobuf type <code>google.cloud.dataproc.v1.ReservationAffinity.Type</code>
 */
class Type
{
    /**
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * Do not consume from any allocated capacity.
     *
     * Generated from protobuf enum <code>NO_RESERVATION = 1;</code>
     */
    const NO_RESERVATION = 1;
    /**
     * Consume any reservation available.
     *
     * Generated from protobuf enum <code>ANY_RESERVATION = 2;</code>
     */
    const ANY_RESERVATION = 2;
    /**
     * Must consume from a specific reservation. Must specify key value fields
     * for specifying the reservations.
     *
     * Generated from protobuf enum <code>SPECIFIC_RESERVATION = 3;</code>
     */
    const SPECIFIC_RESERVATION = 3;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::NO_RESERVATION => 'NO_RESERVATION',
        self::ANY_RESERVATION => 'ANY_RESERVATION',
        self::SPECIFIC_RESERVATION => 'SPECIFIC_RESERVATION',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Type::class, \Google\Cloud\Dataproc\V1\ReservationAffinity_Type::class);

