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

namespace OS\PB;

use UnexpectedValueException;

/**
 ** \@brief   Restart the device
 *
 * Protobuf type <code>OS.PB.DeviceRestartMethod</code>
 */
class DeviceRestartMethod
{
    /**
     * Do nothing
     *
     * Generated from protobuf enum <code>RestartMethod_NotSet = 0;</code>
     */
    const RestartMethod_NotSet = 0;
    /**
     * allows time for an event to be sent to server and disconnects from MQTT, finishes syncing files etc.
     *
     * Generated from protobuf enum <code>RestartMethod_Graceful = 1;</code>
     */
    const RestartMethod_Graceful = 1;
    /**
     * restarts immediately - not recommended as can cause corruption
     *
     * Generated from protobuf enum <code>RestartMethod_Forceful = 2;</code>
     */
    const RestartMethod_Forceful = 2;

    private static $valueToName = [
        self::RestartMethod_NotSet => 'RestartMethod_NotSet',
        self::RestartMethod_Graceful => 'RestartMethod_Graceful',
        self::RestartMethod_Forceful => 'RestartMethod_Forceful',
    ];

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

