<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: apache/rocketmq/v2/admin.proto

namespace Apache\Rocketmq\V2\ChangeLogLevelRequest;

use UnexpectedValueException;

/**
 * Protobuf type <code>apache.rocketmq.v2.ChangeLogLevelRequest.Level</code>
 */
class Level
{
    /**
     * Generated from protobuf enum <code>TRACE = 0;</code>
     */
    const TRACE = 0;
    /**
     * Generated from protobuf enum <code>DEBUG = 1;</code>
     */
    const DEBUG = 1;
    /**
     * Generated from protobuf enum <code>INFO = 2;</code>
     */
    const INFO = 2;
    /**
     * Generated from protobuf enum <code>WARN = 3;</code>
     */
    const WARN = 3;
    /**
     * Generated from protobuf enum <code>ERROR = 4;</code>
     */
    const ERROR = 4;

    private static $valueToName = [
        self::TRACE => 'TRACE',
        self::DEBUG => 'DEBUG',
        self::INFO => 'INFO',
        self::WARN => 'WARN',
        self::ERROR => 'ERROR',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Level::class, \Apache\Rocketmq\V2\ChangeLogLevelRequest_Level::class);

