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

namespace OS\PB\OSDPConfig;

use UnexpectedValueException;

/**
 * Protobuf type <code>OS.PB.OSDPConfig.KeypadModes</code>
 */
class KeypadModes
{
    /**
     * Generated from protobuf enum <code>KeypadMode_NotSet = 0;</code>
     */
    const KeypadMode_NotSet = 0;
    /**
     * OSDP will not create pin codes events
     *
     * Generated from protobuf enum <code>KeypadMode_Disabled = 1;</code>
     */
    const KeypadMode_Disabled = 1;
    /**
     * OSDP will create pincode based on keypress osdp poll response, but requires hash or asterisk to end
     *
     * Generated from protobuf enum <code>KeypadMode_Enabled = 2;</code>
     */
    const KeypadMode_Enabled = 2;
    /**
     * (Default) OSDP will create the pincode based on keypresses and once the required digits is reached, generates the pincode event
     *
     * Generated from protobuf enum <code>KeypadMode_Enabled_AutoEnd = 3;</code>
     */
    const KeypadMode_Enabled_AutoEnd = 3;

    private static $valueToName = [
        self::KeypadMode_NotSet => 'KeypadMode_NotSet',
        self::KeypadMode_Disabled => 'KeypadMode_Disabled',
        self::KeypadMode_Enabled => 'KeypadMode_Enabled',
        self::KeypadMode_Enabled_AutoEnd => 'KeypadMode_Enabled_AutoEnd',
    ];

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

