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

namespace Temporal\Api\Enums\V1;

use UnexpectedValueException;

/**
 * Source for the effective rate limit.
 *
 * Protobuf type <code>temporal.api.enums.v1.RateLimitSource</code>
 */
class RateLimitSource
{
    /**
     * Generated from protobuf enum <code>RATE_LIMIT_SOURCE_UNSPECIFIED = 0;</code>
     */
    const RATE_LIMIT_SOURCE_UNSPECIFIED = 0;
    /**
     * The value was set by the API.
     *
     * Generated from protobuf enum <code>RATE_LIMIT_SOURCE_API = 1;</code>
     */
    const RATE_LIMIT_SOURCE_API = 1;
    /**
     * The value was set by a worker.
     *
     * Generated from protobuf enum <code>RATE_LIMIT_SOURCE_WORKER = 2;</code>
     */
    const RATE_LIMIT_SOURCE_WORKER = 2;
    /**
     * The value was set as the system default.
     *
     * Generated from protobuf enum <code>RATE_LIMIT_SOURCE_SYSTEM = 3;</code>
     */
    const RATE_LIMIT_SOURCE_SYSTEM = 3;

    private static $valueToName = [
        self::RATE_LIMIT_SOURCE_UNSPECIFIED => 'RATE_LIMIT_SOURCE_UNSPECIFIED',
        self::RATE_LIMIT_SOURCE_API => 'RATE_LIMIT_SOURCE_API',
        self::RATE_LIMIT_SOURCE_WORKER => 'RATE_LIMIT_SOURCE_WORKER',
        self::RATE_LIMIT_SOURCE_SYSTEM => 'RATE_LIMIT_SOURCE_SYSTEM',
    ];

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

