<?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;

/**
 * Protobuf type <code>temporal.api.enums.v1.ContinueAsNewInitiator</code>
 */
class ContinueAsNewInitiator
{
    /**
     * Generated from protobuf enum <code>CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED = 0;</code>
     */
    const CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED = 0;
    /**
     * The workflow itself requested to continue as new
     *
     * Generated from protobuf enum <code>CONTINUE_AS_NEW_INITIATOR_WORKFLOW = 1;</code>
     */
    const CONTINUE_AS_NEW_INITIATOR_WORKFLOW = 1;
    /**
     * The workflow continued as new because it is retrying
     *
     * Generated from protobuf enum <code>CONTINUE_AS_NEW_INITIATOR_RETRY = 2;</code>
     */
    const CONTINUE_AS_NEW_INITIATOR_RETRY = 2;
    /**
     * The workflow continued as new because cron has triggered a new execution
     *
     * Generated from protobuf enum <code>CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE = 3;</code>
     */
    const CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE = 3;

    private static $valueToName = [
        self::CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED => 'CONTINUE_AS_NEW_INITIATOR_UNSPECIFIED',
        self::CONTINUE_AS_NEW_INITIATOR_WORKFLOW => 'CONTINUE_AS_NEW_INITIATOR_WORKFLOW',
        self::CONTINUE_AS_NEW_INITIATOR_RETRY => 'CONTINUE_AS_NEW_INITIATOR_RETRY',
        self::CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE => 'CONTINUE_AS_NEW_INITIATOR_CRON_SCHEDULE',
    ];

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

