<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: livekit_rtc.proto

namespace Livekit\RequestResponse;

use UnexpectedValueException;

/**
 * Protobuf type <code>livekit.RequestResponse.Reason</code>
 */
class Reason
{
    /**
     * Generated from protobuf enum <code>OK = 0;</code>
     */
    const OK = 0;
    /**
     * Generated from protobuf enum <code>NOT_FOUND = 1;</code>
     */
    const NOT_FOUND = 1;
    /**
     * Generated from protobuf enum <code>NOT_ALLOWED = 2;</code>
     */
    const NOT_ALLOWED = 2;
    /**
     * Generated from protobuf enum <code>LIMIT_EXCEEDED = 3;</code>
     */
    const LIMIT_EXCEEDED = 3;
    /**
     * Generated from protobuf enum <code>QUEUED = 4;</code>
     */
    const QUEUED = 4;
    /**
     * Generated from protobuf enum <code>UNSUPPORTED_TYPE = 5;</code>
     */
    const UNSUPPORTED_TYPE = 5;
    /**
     * Generated from protobuf enum <code>UNCLASSIFIED_ERROR = 6;</code>
     */
    const UNCLASSIFIED_ERROR = 6;
    /**
     * Generated from protobuf enum <code>INVALID_HANDLE = 7;</code>
     */
    const INVALID_HANDLE = 7;
    /**
     * Generated from protobuf enum <code>INVALID_NAME = 8;</code>
     */
    const INVALID_NAME = 8;
    /**
     * Generated from protobuf enum <code>DUPLICATE_HANDLE = 9;</code>
     */
    const DUPLICATE_HANDLE = 9;
    /**
     * Generated from protobuf enum <code>DUPLICATE_NAME = 10;</code>
     */
    const DUPLICATE_NAME = 10;

    private static $valueToName = [
        self::OK => 'OK',
        self::NOT_FOUND => 'NOT_FOUND',
        self::NOT_ALLOWED => 'NOT_ALLOWED',
        self::LIMIT_EXCEEDED => 'LIMIT_EXCEEDED',
        self::QUEUED => 'QUEUED',
        self::UNSUPPORTED_TYPE => 'UNSUPPORTED_TYPE',
        self::UNCLASSIFIED_ERROR => 'UNCLASSIFIED_ERROR',
        self::INVALID_HANDLE => 'INVALID_HANDLE',
        self::INVALID_NAME => 'INVALID_NAME',
        self::DUPLICATE_HANDLE => 'DUPLICATE_HANDLE',
        self::DUPLICATE_NAME => 'DUPLICATE_NAME',
    ];

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

