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

namespace Keyapis\Event\V1\Event;

use UnexpectedValueException;

/**
 * Тип устройства
 *
 * Protobuf type <code>keyapis.event.v1.Event.DeviceType</code>
 */
class DeviceType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>DEVICE_TYPE_UNKNOWN = 0;</code>
     */
    const DEVICE_TYPE_UNKNOWN = 0;
    /**
     * Домофон
     *
     * Generated from protobuf enum <code>INTERCOM = 1;</code>
     */
    const INTERCOM = 1;
    /**
     * Шлагбаум
     *
     * Generated from protobuf enum <code>BARRIER = 2;</code>
     */
    const BARRIER = 2;
    /**
     * Калитка
     *
     * Generated from protobuf enum <code>GATE = 3;</code>
     */
    const GATE = 3;
    /**
     * СКУД
     *
     * Generated from protobuf enum <code>ACCESS_CONTROL_PANEL = 4;</code>
     */
    const ACCESS_CONTROL_PANEL = 4;
    /**
     * Камера
     *
     * Generated from protobuf enum <code>VIDEOCAMERA = 5;</code>
     */
    const VIDEOCAMERA = 5;

    private static $valueToName = [
        self::DEVICE_TYPE_UNKNOWN => 'DEVICE_TYPE_UNKNOWN',
        self::INTERCOM => 'INTERCOM',
        self::BARRIER => 'BARRIER',
        self::GATE => 'GATE',
        self::ACCESS_CONTROL_PANEL => 'ACCESS_CONTROL_PANEL',
        self::VIDEOCAMERA => 'VIDEOCAMERA',
    ];

    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(DeviceType::class, \Keyapis\Event\V1\Event_DeviceType::class);

