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

namespace Google\Cloud\Dataproc\V1\JobStatus;

use UnexpectedValueException;

/**
 * The job substate.
 *
 * Protobuf type <code>google.cloud.dataproc.v1.JobStatus.Substate</code>
 */
class Substate
{
    /**
     * The job substate is unknown.
     *
     * Generated from protobuf enum <code>UNSPECIFIED = 0;</code>
     */
    const UNSPECIFIED = 0;
    /**
     * The Job is submitted to the agent.
     * Applies to RUNNING state.
     *
     * Generated from protobuf enum <code>SUBMITTED = 1;</code>
     */
    const SUBMITTED = 1;
    /**
     * The Job has been received and is awaiting execution (it might be waiting
     * for a condition to be met). See the "details" field for the reason for
     * the delay.
     * Applies to RUNNING state.
     *
     * Generated from protobuf enum <code>QUEUED = 2;</code>
     */
    const QUEUED = 2;
    /**
     * The agent-reported status is out of date, which can be caused by a
     * loss of communication between the agent and Dataproc. If the
     * agent does not send a timely update, the job will fail.
     * Applies to RUNNING state.
     *
     * Generated from protobuf enum <code>STALE_STATUS = 3;</code>
     */
    const STALE_STATUS = 3;

    private static $valueToName = [
        self::UNSPECIFIED => 'UNSPECIFIED',
        self::SUBMITTED => 'SUBMITTED',
        self::QUEUED => 'QUEUED',
        self::STALE_STATUS => 'STALE_STATUS',
    ];

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


