<?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;

/**
 * Health defines the status of a TPU node as reported by
 * Health Monitor.
 *
 * Protobuf type <code>google.cloud.tpu.v1.Node.Health</code>
 */
class Health
{
    /**
     * Health status is unknown: not initialized or failed to retrieve.
     *
     * Generated from protobuf enum <code>HEALTH_UNSPECIFIED = 0;</code>
     */
    const HEALTH_UNSPECIFIED = 0;
    /**
     * The resource is healthy.
     *
     * Generated from protobuf enum <code>HEALTHY = 1;</code>
     */
    const HEALTHY = 1;
    /**
     * The resource is unhealthy.
     *
     * Generated from protobuf enum <code>DEPRECATED_UNHEALTHY = 2;</code>
     */
    const DEPRECATED_UNHEALTHY = 2;
    /**
     * The resource is unresponsive.
     *
     * Generated from protobuf enum <code>TIMEOUT = 3;</code>
     */
    const TIMEOUT = 3;
    /**
     * The in-guest ML stack is unhealthy.
     *
     * Generated from protobuf enum <code>UNHEALTHY_TENSORFLOW = 4;</code>
     */
    const UNHEALTHY_TENSORFLOW = 4;
    /**
     * The node is under maintenance/priority boost caused rescheduling and
     * will resume running once rescheduled.
     *
     * Generated from protobuf enum <code>UNHEALTHY_MAINTENANCE = 5;</code>
     */
    const UNHEALTHY_MAINTENANCE = 5;

    private static $valueToName = [
        self::HEALTH_UNSPECIFIED => 'HEALTH_UNSPECIFIED',
        self::HEALTHY => 'HEALTHY',
        self::DEPRECATED_UNHEALTHY => 'DEPRECATED_UNHEALTHY',
        self::TIMEOUT => 'TIMEOUT',
        self::UNHEALTHY_TENSORFLOW => 'UNHEALTHY_TENSORFLOW',
        self::UNHEALTHY_MAINTENANCE => 'UNHEALTHY_MAINTENANCE',
    ];

    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(Health::class, \Google\Cloud\Tpu\V1\Node_Health::class);

