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

namespace OS\PB\DFURequest;

use UnexpectedValueException;

/**
 * Options for generating a DFUAction corresponding event 
 *
 * Protobuf type <code>OS.PB.DFURequest.DFUProgressOptions</code>
 */
class DFUProgressOptions
{
    /**
     * Generated from protobuf enum <code>DFUProgressOption_Disabled = 0;</code>
     */
    const DFUProgressOption_Disabled = 0;
    /**
     * An event will be generated when moving from one status to another
     *
     * Generated from protobuf enum <code>DFUProgressOption_StatusChangeOnly = 1;</code>
     */
    const DFUProgressOption_StatusChangeOnly = 1;
    /**
     * A event will be generated per block written
     *
     * Generated from protobuf enum <code>DFUProgressOption_StatusAndPerBlock = 2;</code>
     */
    const DFUProgressOption_StatusAndPerBlock = 2;
    /**
     * A event will be generated per percentage point (for user interface), up to 100 progress events will be generated
     *
     * Generated from protobuf enum <code>DFUProgressOption_StatusAndPerPercent = 3;</code>
     */
    const DFUProgressOption_StatusAndPerPercent = 3;
    /**
     * A event will be generated per 10 percentage points (for user interface), up to 10 progress events will be generated
     *
     * Generated from protobuf enum <code>DFUProgressOption_StatusAndPer10Percent = 4;</code>
     */
    const DFUProgressOption_StatusAndPer10Percent = 4;

    private static $valueToName = [
        self::DFUProgressOption_Disabled => 'DFUProgressOption_Disabled',
        self::DFUProgressOption_StatusChangeOnly => 'DFUProgressOption_StatusChangeOnly',
        self::DFUProgressOption_StatusAndPerBlock => 'DFUProgressOption_StatusAndPerBlock',
        self::DFUProgressOption_StatusAndPerPercent => 'DFUProgressOption_StatusAndPerPercent',
        self::DFUProgressOption_StatusAndPer10Percent => 'DFUProgressOption_StatusAndPer10Percent',
    ];

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

