<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: temporal/api/enums/v1/workflow.proto

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * (-- api-linter: core::0216::synonyms=disabled
 *     aip.dev/not-precedent: There is WorkflowExecutionState already in another package. --)
 *
 * Protobuf type <code>temporal.api.enums.v1.WorkflowExecutionStatus</code>
 */
class WorkflowExecutionStatus
{
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_UNSPECIFIED = 0;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_UNSPECIFIED = 0;
    /**
     * Value 1 is hardcoded in SQL persistence.
     *
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_RUNNING = 1;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_RUNNING = 1;
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_COMPLETED = 2;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_COMPLETED = 2;
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_FAILED = 3;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_FAILED = 3;
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_CANCELED = 4;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_CANCELED = 4;
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_TERMINATED = 5;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_TERMINATED = 5;
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW = 6;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW = 6;
    /**
     * Generated from protobuf enum <code>WORKFLOW_EXECUTION_STATUS_TIMED_OUT = 7;</code>
     */
    const WORKFLOW_EXECUTION_STATUS_TIMED_OUT = 7;

    private static $valueToName = [
        self::WORKFLOW_EXECUTION_STATUS_UNSPECIFIED => 'WORKFLOW_EXECUTION_STATUS_UNSPECIFIED',
        self::WORKFLOW_EXECUTION_STATUS_RUNNING => 'WORKFLOW_EXECUTION_STATUS_RUNNING',
        self::WORKFLOW_EXECUTION_STATUS_COMPLETED => 'WORKFLOW_EXECUTION_STATUS_COMPLETED',
        self::WORKFLOW_EXECUTION_STATUS_FAILED => 'WORKFLOW_EXECUTION_STATUS_FAILED',
        self::WORKFLOW_EXECUTION_STATUS_CANCELED => 'WORKFLOW_EXECUTION_STATUS_CANCELED',
        self::WORKFLOW_EXECUTION_STATUS_TERMINATED => 'WORKFLOW_EXECUTION_STATUS_TERMINATED',
        self::WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW => 'WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW',
        self::WORKFLOW_EXECUTION_STATUS_TIMED_OUT => 'WORKFLOW_EXECUTION_STATUS_TIMED_OUT',
    ];

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

