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

namespace Google\Cloud\AIPlatform\V1;

use UnexpectedValueException;

/**
 * Describes the state of a job.
 *
 * Protobuf type <code>google.cloud.aiplatform.v1.JobState</code>
 */
class JobState
{
    /**
     * The job state is unspecified.
     *
     * Generated from protobuf enum <code>JOB_STATE_UNSPECIFIED = 0;</code>
     */
    const JOB_STATE_UNSPECIFIED = 0;
    /**
     * The job has been just created or resumed and processing has not yet begun.
     *
     * Generated from protobuf enum <code>JOB_STATE_QUEUED = 1;</code>
     */
    const JOB_STATE_QUEUED = 1;
    /**
     * The service is preparing to run the job.
     *
     * Generated from protobuf enum <code>JOB_STATE_PENDING = 2;</code>
     */
    const JOB_STATE_PENDING = 2;
    /**
     * The job is in progress.
     *
     * Generated from protobuf enum <code>JOB_STATE_RUNNING = 3;</code>
     */
    const JOB_STATE_RUNNING = 3;
    /**
     * The job completed successfully.
     *
     * Generated from protobuf enum <code>JOB_STATE_SUCCEEDED = 4;</code>
     */
    const JOB_STATE_SUCCEEDED = 4;
    /**
     * The job failed.
     *
     * Generated from protobuf enum <code>JOB_STATE_FAILED = 5;</code>
     */
    const JOB_STATE_FAILED = 5;
    /**
     * The job is being cancelled. From this state the job may only go to
     * either `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED` or `JOB_STATE_CANCELLED`.
     *
     * Generated from protobuf enum <code>JOB_STATE_CANCELLING = 6;</code>
     */
    const JOB_STATE_CANCELLING = 6;
    /**
     * The job has been cancelled.
     *
     * Generated from protobuf enum <code>JOB_STATE_CANCELLED = 7;</code>
     */
    const JOB_STATE_CANCELLED = 7;
    /**
     * The job has been stopped, and can be resumed.
     *
     * Generated from protobuf enum <code>JOB_STATE_PAUSED = 8;</code>
     */
    const JOB_STATE_PAUSED = 8;
    /**
     * The job has expired.
     *
     * Generated from protobuf enum <code>JOB_STATE_EXPIRED = 9;</code>
     */
    const JOB_STATE_EXPIRED = 9;
    /**
     * The job is being updated. Only jobs in the `RUNNING` state can be updated.
     * After updating, the job goes back to the `RUNNING` state.
     *
     * Generated from protobuf enum <code>JOB_STATE_UPDATING = 10;</code>
     */
    const JOB_STATE_UPDATING = 10;
    /**
     * The job is partially succeeded, some results may be missing due to errors.
     *
     * Generated from protobuf enum <code>JOB_STATE_PARTIALLY_SUCCEEDED = 11;</code>
     */
    const JOB_STATE_PARTIALLY_SUCCEEDED = 11;

    private static $valueToName = [
        self::JOB_STATE_UNSPECIFIED => 'JOB_STATE_UNSPECIFIED',
        self::JOB_STATE_QUEUED => 'JOB_STATE_QUEUED',
        self::JOB_STATE_PENDING => 'JOB_STATE_PENDING',
        self::JOB_STATE_RUNNING => 'JOB_STATE_RUNNING',
        self::JOB_STATE_SUCCEEDED => 'JOB_STATE_SUCCEEDED',
        self::JOB_STATE_FAILED => 'JOB_STATE_FAILED',
        self::JOB_STATE_CANCELLING => 'JOB_STATE_CANCELLING',
        self::JOB_STATE_CANCELLED => 'JOB_STATE_CANCELLED',
        self::JOB_STATE_PAUSED => 'JOB_STATE_PAUSED',
        self::JOB_STATE_EXPIRED => 'JOB_STATE_EXPIRED',
        self::JOB_STATE_UPDATING => 'JOB_STATE_UPDATING',
        self::JOB_STATE_PARTIALLY_SUCCEEDED => 'JOB_STATE_PARTIALLY_SUCCEEDED',
    ];

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

