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

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * State of a callback.
 *
 * Protobuf type <code>temporal.api.enums.v1.CallbackState</code>
 */
class CallbackState
{
    /**
     * Default value, unspecified state.
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_UNSPECIFIED = 0;</code>
     */
    const CALLBACK_STATE_UNSPECIFIED = 0;
    /**
     * Callback is standing by, waiting to be triggered.
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_STANDBY = 1;</code>
     */
    const CALLBACK_STATE_STANDBY = 1;
    /**
     * Callback is in the queue waiting to be executed or is currently executing.
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_SCHEDULED = 2;</code>
     */
    const CALLBACK_STATE_SCHEDULED = 2;
    /**
     * Callback has failed with a retryable error and is backing off before the next attempt.
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_BACKING_OFF = 3;</code>
     */
    const CALLBACK_STATE_BACKING_OFF = 3;
    /**
     * Callback has failed.
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_FAILED = 4;</code>
     */
    const CALLBACK_STATE_FAILED = 4;
    /**
     * Callback has succeeded.
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_SUCCEEDED = 5;</code>
     */
    const CALLBACK_STATE_SUCCEEDED = 5;
    /**
     * Callback is blocked (eg: by circuit breaker).
     *
     * Generated from protobuf enum <code>CALLBACK_STATE_BLOCKED = 6;</code>
     */
    const CALLBACK_STATE_BLOCKED = 6;

    private static $valueToName = [
        self::CALLBACK_STATE_UNSPECIFIED => 'CALLBACK_STATE_UNSPECIFIED',
        self::CALLBACK_STATE_STANDBY => 'CALLBACK_STATE_STANDBY',
        self::CALLBACK_STATE_SCHEDULED => 'CALLBACK_STATE_SCHEDULED',
        self::CALLBACK_STATE_BACKING_OFF => 'CALLBACK_STATE_BACKING_OFF',
        self::CALLBACK_STATE_FAILED => 'CALLBACK_STATE_FAILED',
        self::CALLBACK_STATE_SUCCEEDED => 'CALLBACK_STATE_SUCCEEDED',
        self::CALLBACK_STATE_BLOCKED => 'CALLBACK_STATE_BLOCKED',
    ];

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

