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

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * UpdateWorkflowExecutionLifecycleStage is specified by clients invoking
 * Workflow Updates and used to indicate to the server how long the
 * client wishes to wait for a return value from the API. If any value other
 * than UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED is sent by the
 * client then the API will complete before the Update is finished and will
 * return a handle to the running Update so that it can later be polled for
 * completion.
 * If specified stage wasn't reached before server timeout, server returns
 * actual stage reached.
 *
 * Protobuf type <code>temporal.api.enums.v1.UpdateWorkflowExecutionLifecycleStage</code>
 */
class UpdateWorkflowExecutionLifecycleStage
{
    /**
     * An unspecified value for this enum.
     *
     * Generated from protobuf enum <code>UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED = 0;</code>
     */
    const UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED = 0;
    /**
     * The API call will not return until the Update request has been admitted
     * by the server - it may be the case that due to a considerations like load
     * or resource limits that an Update is made to wait before the server will
     * indicate that it has been received and will be processed. This value
     * does not wait for any sort of acknowledgement from a worker.
     *
     * Generated from protobuf enum <code>UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED = 1;</code>
     */
    const UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED = 1;
    /**
     * The API call will not return until the Update has passed validation on a worker.
     *
     * Generated from protobuf enum <code>UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED = 2;</code>
     */
    const UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED = 2;
    /**
     * The API call will not return until the Update has executed to completion
     * on a worker and has either been rejected or returned a value or an error.
     *
     * Generated from protobuf enum <code>UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;</code>
     */
    const UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED = 3;

    private static $valueToName = [
        self::UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED => 'UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_UNSPECIFIED',
        self::UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED => 'UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ADMITTED',
        self::UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED => 'UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_ACCEPTED',
        self::UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED => 'UPDATE_WORKFLOW_EXECUTION_LIFECYCLE_STAGE_COMPLETED',
    ];

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

