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

namespace OS\PB;

use UnexpectedValueException;

/**
 * Protobuf type <code>OS.PB.HealthButtonFlags</code>
 */
class HealthButtonFlags
{
    /**
     * Generated from protobuf enum <code>HealthButtonFlags_NotSet = 0;</code>
     */
    const HealthButtonFlags_NotSet = 0;
    /**
     * The button indicated it browned out, so its operating at lower power levels
     *
     * Generated from protobuf enum <code>HealthButton_BrownOut = 1;</code>
     */
    const HealthButton_BrownOut = 1;
    /**
     * The button indicated it had a fault
     *
     * Generated from protobuf enum <code>HealthButton_Fault = 2;</code>
     */
    const HealthButton_Fault = 2;
    /**
     * This button was configured the Link device and assigned a light, which was activated.
     *
     * Generated from protobuf enum <code>HealthButton_Configured = 16;</code>
     */
    const HealthButton_Configured = 16;
    /**
     * Combination of both Brownout and Fault bits
     *
     * Generated from protobuf enum <code>HealthButton_Brownout_Fault = 3;</code>
     */
    const HealthButton_Brownout_Fault = 3;

    private static $valueToName = [
        self::HealthButtonFlags_NotSet => 'HealthButtonFlags_NotSet',
        self::HealthButton_BrownOut => 'HealthButton_BrownOut',
        self::HealthButton_Fault => 'HealthButton_Fault',
        self::HealthButton_Configured => 'HealthButton_Configured',
        self::HealthButton_Brownout_Fault => 'HealthButton_Brownout_Fault',
    ];

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

