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

namespace OS\PB\DFUResponse;

use UnexpectedValueException;

/**
 * Protobuf type <code>OS.PB.DFUResponse.DFUResponseType</code>
 */
class DFUResponseType
{
    /**
     * Generated from protobuf enum <code>DFUResponse_NotSet = 0;</code>
     */
    const DFUResponse_NotSet = 0;
    /**
     * request was successful, otherwise some other error code is returned
     *
     * Generated from protobuf enum <code>DFUResponse_Success = 1;</code>
     */
    const DFUResponse_Success = 1;
    /**
     * request status
     *
     * Generated from protobuf enum <code>DFUResponse_NotInitiated = 2;</code>
     */
    const DFUResponse_NotInitiated = 2;
    /**
     * The device has erased the flash required for the firmware image to be downloaded to
     *
     * Generated from protobuf enum <code>DFUResponse_Initiated = 3;</code>
     */
    const DFUResponse_Initiated = 3;
    /**
     * The device is downloading DFUTransferBlock from the cloud
     *
     * Generated from protobuf enum <code>DFUResponse_Downloading = 4;</code>
     */
    const DFUResponse_Downloading = 4;
    /**
     * The device is verifying that the downloaded image is correct and matches the hash
     *
     * Generated from protobuf enum <code>DFUResponse_Verifying = 5;</code>
     */
    const DFUResponse_Verifying = 5;
    /**
     * The device has swapped over to the new image, is validating that the image doesn't crash
     *
     * Generated from protobuf enum <code>DFUResponse_Validating = 7;</code>
     */
    const DFUResponse_Validating = 7;
    /**
     * The device has validated the image is good, it will not rollback
     *
     * Generated from protobuf enum <code>DFUResponse_Completed = 8;</code>
     */
    const DFUResponse_Completed = 8;
    /**
     * Something caused the dfu process to fail, inspect message for more
     *
     * Generated from protobuf enum <code>DFUResponse_Failed = 9;</code>
     */
    const DFUResponse_Failed = 9;
    /**
     * error codes for initiate
     *
     * Generated from protobuf enum <code>DFUResponse_SizeTooLarge = 10;</code>
     */
    const DFUResponse_SizeTooLarge = 10;
    /**
     * A value set in the request was invalid
     *
     * Generated from protobuf enum <code>DFUResponse_InvalidValue = 11;</code>
     */
    const DFUResponse_InvalidValue = 11;
    /**
     * The dfu platform didn't match what is in the firmware
     *
     * Generated from protobuf enum <code>DFUResponse_HardwarePlatformMismatch = 12;</code>
     */
    const DFUResponse_HardwarePlatformMismatch = 12;
    /**
     * The dfu process is already in progress, must either continue or cancel before doing another initiate
     *
     * Generated from protobuf enum <code>DFUResponse_AlreadyInitiated = 13;</code>
     */
    const DFUResponse_AlreadyInitiated = 13;
    /**
     * Something went wrong during initializing the dfu process
     *
     * Generated from protobuf enum <code>DFUResponse_InitializeFailed = 14;</code>
     */
    const DFUResponse_InitializeFailed = 14;

    private static $valueToName = [
        self::DFUResponse_NotSet => 'DFUResponse_NotSet',
        self::DFUResponse_Success => 'DFUResponse_Success',
        self::DFUResponse_NotInitiated => 'DFUResponse_NotInitiated',
        self::DFUResponse_Initiated => 'DFUResponse_Initiated',
        self::DFUResponse_Downloading => 'DFUResponse_Downloading',
        self::DFUResponse_Verifying => 'DFUResponse_Verifying',
        self::DFUResponse_Validating => 'DFUResponse_Validating',
        self::DFUResponse_Completed => 'DFUResponse_Completed',
        self::DFUResponse_Failed => 'DFUResponse_Failed',
        self::DFUResponse_SizeTooLarge => 'DFUResponse_SizeTooLarge',
        self::DFUResponse_InvalidValue => 'DFUResponse_InvalidValue',
        self::DFUResponse_HardwarePlatformMismatch => 'DFUResponse_HardwarePlatformMismatch',
        self::DFUResponse_AlreadyInitiated => 'DFUResponse_AlreadyInitiated',
        self::DFUResponse_InitializeFailed => 'DFUResponse_InitializeFailed',
    ];

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

