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

namespace Google\Cloud\Tpu\V1\Node;

use UnexpectedValueException;

/**
 * TPU API Version.
 *
 * Protobuf type <code>google.cloud.tpu.v1.Node.ApiVersion</code>
 */
class ApiVersion
{
    /**
     * API version is unknown.
     *
     * Generated from protobuf enum <code>API_VERSION_UNSPECIFIED = 0;</code>
     */
    const API_VERSION_UNSPECIFIED = 0;
    /**
     * TPU API V1Alpha1 version.
     *
     * Generated from protobuf enum <code>V1_ALPHA1 = 1;</code>
     */
    const V1_ALPHA1 = 1;
    /**
     * TPU API V1 version.
     *
     * Generated from protobuf enum <code>V1 = 2;</code>
     */
    const V1 = 2;
    /**
     * TPU API V2Alpha1 version.
     *
     * Generated from protobuf enum <code>V2_ALPHA1 = 3;</code>
     */
    const V2_ALPHA1 = 3;

    private static $valueToName = [
        self::API_VERSION_UNSPECIFIED => 'API_VERSION_UNSPECIFIED',
        self::V1_ALPHA1 => 'V1_ALPHA1',
        self::V1 => 'V1',
        self::V2_ALPHA1 => 'V2_ALPHA1',
    ];

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


