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

namespace Livekit\LeaveRequest;

use UnexpectedValueException;

/**
 * indicates action clients should take on receiving this message
 *
 * Protobuf type <code>livekit.LeaveRequest.Action</code>
 */
class Action
{
    /**
     * should disconnect
     *
     * Generated from protobuf enum <code>DISCONNECT = 0;</code>
     */
    const DISCONNECT = 0;
    /**
     * should attempt a resume with `reconnect=1` in join URL
     *
     * Generated from protobuf enum <code>RESUME = 1;</code>
     */
    const RESUME = 1;
    /**
     * should attempt a reconnect, i. e. no `reconnect=1`
     *
     * Generated from protobuf enum <code>RECONNECT = 2;</code>
     */
    const RECONNECT = 2;

    private static $valueToName = [
        self::DISCONNECT => 'DISCONNECT',
        self::RESUME => 'RESUME',
        self::RECONNECT => 'RECONNECT',
    ];

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

