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

namespace OS\PB;

use UnexpectedValueException;

/**
 * Protobuf type <code>OS.PB.DeviceFormatReason</code>
 */
class DeviceFormatReason
{
    /**
     * Generated from protobuf enum <code>FormatReason_NotSet = 0;</code>
     */
    const FormatReason_NotSet = 0;
    /**
     * No filesystem exists, so one was created
     *
     * Generated from protobuf enum <code>FormatReason_NoFileSystem = 1;</code>
     */
    const FormatReason_NoFileSystem = 1;
    /**
     * An action caused the filesystem to be formatted
     *
     * Generated from protobuf enum <code>FormatReason_Action = 2;</code>
     */
    const FormatReason_Action = 2;
    /**
     * The fileystem was corrupted, hence formatting was the only option. 
     *
     * Generated from protobuf enum <code>FormatReason_Corrupted = 3;</code>
     */
    const FormatReason_Corrupted = 3;
    /**
     * The device was reflashed with new firmware, hence the filesystem was also formatted
     *
     * Generated from protobuf enum <code>FormatReason_Reflashed = 4;</code>
     */
    const FormatReason_Reflashed = 4;
    /**
     * The device was formatted due to being in a panic bootloop
     *
     * Generated from protobuf enum <code>FormatReason_Recovery = 5;</code>
     */
    const FormatReason_Recovery = 5;
    /**
     * The configured mode was changed between Production and Development
     *
     * Generated from protobuf enum <code>FormatReason_ModeChange = 6;</code>
     */
    const FormatReason_ModeChange = 6;
    /**
     * The device was factory defaulted by shorting the header pin
     *
     * Generated from protobuf enum <code>FormatReason_Pin = 7;</code>
     */
    const FormatReason_Pin = 7;

    private static $valueToName = [
        self::FormatReason_NotSet => 'FormatReason_NotSet',
        self::FormatReason_NoFileSystem => 'FormatReason_NoFileSystem',
        self::FormatReason_Action => 'FormatReason_Action',
        self::FormatReason_Corrupted => 'FormatReason_Corrupted',
        self::FormatReason_Reflashed => 'FormatReason_Reflashed',
        self::FormatReason_Recovery => 'FormatReason_Recovery',
        self::FormatReason_ModeChange => 'FormatReason_ModeChange',
        self::FormatReason_Pin => 'FormatReason_Pin',
    ];

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

