<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: deviceapis/device/v1/deviceapis_device_relay_v1.proto

namespace Deviceapis\Device\V1\RelayOpen;

use UnexpectedValueException;

/**
 * Тип замка
 *
 * Protobuf type <code>deviceapis.device.v1.RelayOpen.LockType</code>
 */
class LockType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>LOCK_TYPE_UNKNOWN = 0;</code>
     */
    const LOCK_TYPE_UNKNOWN = 0;
    /**
     * Электромагнитный (state_operation)
     *
     * Generated from protobuf enum <code>ELECTROMAGNETIC = 1;</code>
     */
    const ELECTROMAGNETIC = 1;
    /**
     * Электромеханический (pulse_operation)
     *
     * Generated from protobuf enum <code>ELECTROMECHANICAL = 2;</code>
     */
    const ELECTROMECHANICAL = 2;

    private static $valueToName = [
        self::LOCK_TYPE_UNKNOWN => 'LOCK_TYPE_UNKNOWN',
        self::ELECTROMAGNETIC => 'ELECTROMAGNETIC',
        self::ELECTROMECHANICAL => 'ELECTROMECHANICAL',
    ];

    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(LockType::class, \Deviceapis\Device\V1\RelayOpen_LockType::class);

