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

namespace Google\Cloud\Tpu\V2\Symptom;

use UnexpectedValueException;

/**
 * SymptomType represents the different types of Symptoms that a TPU can be
 * at.
 *
 * Protobuf type <code>google.cloud.tpu.v2.Symptom.SymptomType</code>
 */
class SymptomType
{
    /**
     * Unspecified symptom.
     *
     * Generated from protobuf enum <code>SYMPTOM_TYPE_UNSPECIFIED = 0;</code>
     */
    const SYMPTOM_TYPE_UNSPECIFIED = 0;
    /**
     * TPU VM memory is low.
     *
     * Generated from protobuf enum <code>LOW_MEMORY = 1;</code>
     */
    const LOW_MEMORY = 1;
    /**
     * TPU runtime is out of memory.
     *
     * Generated from protobuf enum <code>OUT_OF_MEMORY = 2;</code>
     */
    const OUT_OF_MEMORY = 2;
    /**
     * TPU runtime execution has timed out.
     *
     * Generated from protobuf enum <code>EXECUTE_TIMED_OUT = 3;</code>
     */
    const EXECUTE_TIMED_OUT = 3;
    /**
     * TPU runtime fails to construct a mesh that recognizes each TPU device's
     * neighbors.
     *
     * Generated from protobuf enum <code>MESH_BUILD_FAIL = 4;</code>
     */
    const MESH_BUILD_FAIL = 4;
    /**
     * TPU HBM is out of memory.
     *
     * Generated from protobuf enum <code>HBM_OUT_OF_MEMORY = 5;</code>
     */
    const HBM_OUT_OF_MEMORY = 5;
    /**
     * Abusive behaviors have been identified on the current project.
     *
     * Generated from protobuf enum <code>PROJECT_ABUSE = 6;</code>
     */
    const PROJECT_ABUSE = 6;

    private static $valueToName = [
        self::SYMPTOM_TYPE_UNSPECIFIED => 'SYMPTOM_TYPE_UNSPECIFIED',
        self::LOW_MEMORY => 'LOW_MEMORY',
        self::OUT_OF_MEMORY => 'OUT_OF_MEMORY',
        self::EXECUTE_TIMED_OUT => 'EXECUTE_TIMED_OUT',
        self::MESH_BUILD_FAIL => 'MESH_BUILD_FAIL',
        self::HBM_OUT_OF_MEMORY => 'HBM_OUT_OF_MEMORY',
        self::PROJECT_ABUSE => 'PROJECT_ABUSE',
    ];

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


