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

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * Records why a WorkflowExecutionUpdateRequestedEvent was written to history.
 * Note that not all update requests result in this event.
 *
 * Protobuf type <code>temporal.api.enums.v1.UpdateRequestedEventOrigin</code>
 */
class UpdateRequestedEventOrigin
{
    /**
     * Generated from protobuf enum <code>UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED = 0;</code>
     */
    const UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED = 0;
    /**
     * The UpdateRequested event was created when reapplying events during reset
     * or replication. I.e. an accepted update on one branch of workflow history
     * was converted into a requested update on a different branch.
     *
     * Generated from protobuf enum <code>UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY = 1;</code>
     */
    const UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY = 1;

    private static $valueToName = [
        self::UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED => 'UPDATE_REQUESTED_EVENT_ORIGIN_UNSPECIFIED',
        self::UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY => 'UPDATE_REQUESTED_EVENT_ORIGIN_REAPPLY',
    ];

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

