<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/dataflow/v1beta3/metrics.proto

namespace Google\Cloud\Dataflow\V1beta3;

use UnexpectedValueException;

/**
 * The state of some component of job execution.
 *
 * Protobuf type <code>google.dataflow.v1beta3.ExecutionState</code>
 */
class ExecutionState
{
    /**
     * The component state is unknown or unspecified.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_UNKNOWN = 0;</code>
     */
    const EXECUTION_STATE_UNKNOWN = 0;
    /**
     * The component is not yet running.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_NOT_STARTED = 1;</code>
     */
    const EXECUTION_STATE_NOT_STARTED = 1;
    /**
     * The component is currently running.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_RUNNING = 2;</code>
     */
    const EXECUTION_STATE_RUNNING = 2;
    /**
     * The component succeeded.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_SUCCEEDED = 3;</code>
     */
    const EXECUTION_STATE_SUCCEEDED = 3;
    /**
     * The component failed.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_FAILED = 4;</code>
     */
    const EXECUTION_STATE_FAILED = 4;
    /**
     * Execution of the component was cancelled.
     *
     * Generated from protobuf enum <code>EXECUTION_STATE_CANCELLED = 5;</code>
     */
    const EXECUTION_STATE_CANCELLED = 5;

    private static $valueToName = [
        self::EXECUTION_STATE_UNKNOWN => 'EXECUTION_STATE_UNKNOWN',
        self::EXECUTION_STATE_NOT_STARTED => 'EXECUTION_STATE_NOT_STARTED',
        self::EXECUTION_STATE_RUNNING => 'EXECUTION_STATE_RUNNING',
        self::EXECUTION_STATE_SUCCEEDED => 'EXECUTION_STATE_SUCCEEDED',
        self::EXECUTION_STATE_FAILED => 'EXECUTION_STATE_FAILED',
        self::EXECUTION_STATE_CANCELLED => 'EXECUTION_STATE_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)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

