<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: livekit_models.proto

namespace Livekit;

use UnexpectedValueException;

/**
 * Protobuf type <code>livekit.ReconnectReason</code>
 */
class ReconnectReason
{
    /**
     * Generated from protobuf enum <code>RR_UNKNOWN = 0;</code>
     */
    const RR_UNKNOWN = 0;
    /**
     * Generated from protobuf enum <code>RR_SIGNAL_DISCONNECTED = 1;</code>
     */
    const RR_SIGNAL_DISCONNECTED = 1;
    /**
     * Generated from protobuf enum <code>RR_PUBLISHER_FAILED = 2;</code>
     */
    const RR_PUBLISHER_FAILED = 2;
    /**
     * Generated from protobuf enum <code>RR_SUBSCRIBER_FAILED = 3;</code>
     */
    const RR_SUBSCRIBER_FAILED = 3;
    /**
     * Generated from protobuf enum <code>RR_SWITCH_CANDIDATE = 4;</code>
     */
    const RR_SWITCH_CANDIDATE = 4;

    private static $valueToName = [
        self::RR_UNKNOWN => 'RR_UNKNOWN',
        self::RR_SIGNAL_DISCONNECTED => 'RR_SIGNAL_DISCONNECTED',
        self::RR_PUBLISHER_FAILED => 'RR_PUBLISHER_FAILED',
        self::RR_SUBSCRIBER_FAILED => 'RR_SUBSCRIBER_FAILED',
        self::RR_SWITCH_CANDIDATE => 'RR_SWITCH_CANDIDATE',
    ];

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

