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

namespace OS\PB;

use UnexpectedValueException;

/**
 * https://novelbits.io/bluetooth-address-privacy-ble/
 *
 * Protobuf type <code>OS.PB.BTAddressType</code>
 */
class BTAddressType
{
    /**
     * Generated from protobuf enum <code>BTAddress_Public = 0;</code>
     */
    const BTAddress_Public = 0;
    /**
     * Generated from protobuf enum <code>BTAddress_Random = 1;</code>
     */
    const BTAddress_Random = 1;
    /**
     * Generated from protobuf enum <code>BTAddress_Public_Id = 2;</code>
     */
    const BTAddress_Public_Id = 2;
    /**
     * Generated from protobuf enum <code>BTAddress_Random_Id = 3;</code>
     */
    const BTAddress_Random_Id = 3;
    /**
     * Generated from protobuf enum <code>BTAddress_Unresolved = 254;</code>
     */
    const BTAddress_Unresolved = 254;
    /**
     * Generated from protobuf enum <code>BTAddress_Anonymous = 255;</code>
     */
    const BTAddress_Anonymous = 255;

    private static $valueToName = [
        self::BTAddress_Public => 'BTAddress_Public',
        self::BTAddress_Random => 'BTAddress_Random',
        self::BTAddress_Public_Id => 'BTAddress_Public_Id',
        self::BTAddress_Random_Id => 'BTAddress_Random_Id',
        self::BTAddress_Unresolved => 'BTAddress_Unresolved',
        self::BTAddress_Anonymous => 'BTAddress_Anonymous',
    ];

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

