<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: keyapis/iot_connect/v1/keyapis_iot_connect_callback_v1.proto

namespace Keyapis\IotConnect\V1\DeviceState\Value;

use UnexpectedValueException;

/**
 * Тип значения статуса устройства
 *
 * Protobuf type <code>keyapis.iot_connect.v1.DeviceState.Value.Type</code>
 */
class Type
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>TYPE_UNKNOWN = 0;</code>
     */
    const TYPE_UNKNOWN = 0;
    /**
     * Логический тип
     *
     * Generated from protobuf enum <code>BOOL = 1;</code>
     */
    const BOOL = 1;

    private static $valueToName = [
        self::TYPE_UNKNOWN => 'TYPE_UNKNOWN',
        self::BOOL => 'BOOL',
    ];

    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(Type::class, \Keyapis\IotConnect\V1\DeviceState_Value_Type::class);

