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

namespace Google\Cloud\AIPlatform\V1\NasTrial;

use UnexpectedValueException;

/**
 * Describes a NasTrial state.
 *
 * Protobuf type <code>google.cloud.aiplatform.v1.NasTrial.State</code>
 */
class State
{
    /**
     * The NasTrial state is unspecified.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Indicates that a specific NasTrial has been requested, but it has not yet
     * been suggested by the service.
     *
     * Generated from protobuf enum <code>REQUESTED = 1;</code>
     */
    const REQUESTED = 1;
    /**
     * Indicates that the NasTrial has been suggested.
     *
     * Generated from protobuf enum <code>ACTIVE = 2;</code>
     */
    const ACTIVE = 2;
    /**
     * Indicates that the NasTrial should stop according to the service.
     *
     * Generated from protobuf enum <code>STOPPING = 3;</code>
     */
    const STOPPING = 3;
    /**
     * Indicates that the NasTrial is completed successfully.
     *
     * Generated from protobuf enum <code>SUCCEEDED = 4;</code>
     */
    const SUCCEEDED = 4;
    /**
     * Indicates that the NasTrial should not be attempted again.
     * The service will set a NasTrial to INFEASIBLE when it's done but missing
     * the final_measurement.
     *
     * Generated from protobuf enum <code>INFEASIBLE = 5;</code>
     */
    const INFEASIBLE = 5;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::REQUESTED => 'REQUESTED',
        self::ACTIVE => 'ACTIVE',
        self::STOPPING => 'STOPPING',
        self::SUCCEEDED => 'SUCCEEDED',
        self::INFEASIBLE => 'INFEASIBLE',
    ];

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


