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

namespace Livekit\ParticipantInfo;

use UnexpectedValueException;

/**
 * Protobuf type <code>livekit.ParticipantInfo.State</code>
 */
class State
{
    /**
     * websocket' connected, but not offered yet
     *
     * Generated from protobuf enum <code>JOINING = 0;</code>
     */
    const JOINING = 0;
    /**
     * server received client offer
     *
     * Generated from protobuf enum <code>JOINED = 1;</code>
     */
    const JOINED = 1;
    /**
     * ICE connectivity established
     *
     * Generated from protobuf enum <code>ACTIVE = 2;</code>
     */
    const ACTIVE = 2;
    /**
     * WS disconnected
     *
     * Generated from protobuf enum <code>DISCONNECTED = 3;</code>
     */
    const DISCONNECTED = 3;

    private static $valueToName = [
        self::JOINING => 'JOINING',
        self::JOINED => 'JOINED',
        self::ACTIVE => 'ACTIVE',
        self::DISCONNECTED => 'DISCONNECTED',
    ];

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

