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

namespace Google\Cloud\AIPlatform\V1\Trial;

use UnexpectedValueException;

/**
 * Describes a Trial state.
 *
 * Protobuf type <code>google.cloud.aiplatform.v1.Trial.State</code>
 */
class State
{
    /**
     * The Trial state is unspecified.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * Indicates that a specific Trial 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 Trial has been suggested.
     *
     * Generated from protobuf enum <code>ACTIVE = 2;</code>
     */
    const ACTIVE = 2;
    /**
     * Indicates that the Trial should stop according to the service.
     *
     * Generated from protobuf enum <code>STOPPING = 3;</code>
     */
    const STOPPING = 3;
    /**
     * Indicates that the Trial is completed successfully.
     *
     * Generated from protobuf enum <code>SUCCEEDED = 4;</code>
     */
    const SUCCEEDED = 4;
    /**
     * Indicates that the Trial should not be attempted again.
     * The service will set a Trial 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);
    }
}


