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

namespace Google\Cloud\AIPlatform\V1\Execution;

use UnexpectedValueException;

/**
 * Describes the state of the Execution.
 *
 * Protobuf type <code>google.cloud.aiplatform.v1.Execution.State</code>
 */
class State
{
    /**
     * Unspecified Execution state
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The Execution is new
     *
     * Generated from protobuf enum <code>NEW = 1;</code>
     */
    const PBNEW = 1;
    /**
     * The Execution is running
     *
     * Generated from protobuf enum <code>RUNNING = 2;</code>
     */
    const RUNNING = 2;
    /**
     * The Execution has finished running
     *
     * Generated from protobuf enum <code>COMPLETE = 3;</code>
     */
    const COMPLETE = 3;
    /**
     * The Execution has failed
     *
     * Generated from protobuf enum <code>FAILED = 4;</code>
     */
    const FAILED = 4;
    /**
     * The Execution completed through Cache hit.
     *
     * Generated from protobuf enum <code>CACHED = 5;</code>
     */
    const CACHED = 5;
    /**
     * The Execution was cancelled.
     *
     * Generated from protobuf enum <code>CANCELLED = 6;</code>
     */
    const CANCELLED = 6;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::PBNEW => 'NEW',
        self::RUNNING => 'RUNNING',
        self::COMPLETE => 'COMPLETE',
        self::FAILED => 'FAILED',
        self::CACHED => 'CACHED',
        self::CANCELLED => 'CANCELLED',
    ];

    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)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}


