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

namespace OS\PB;

use UnexpectedValueException;

/**
 **
 * \@brief Device FileSystem Status codes - these are the same as LittleFS error codes with the negative removed
 *
 * Protobuf type <code>OS.PB.FileResultTypes</code>
 */
class FileResultTypes
{
    /**
     * No error
     *
     * Generated from protobuf enum <code>FileResult_Ok = 0;</code>
     */
    const FileResult_Ok = 0;
    /**
     * LFS: Error during file system operation
     *
     * Generated from protobuf enum <code>FileResult_ErrorIO = 5;</code>
     */
    const FileResult_ErrorIO = 5;
    /**
     * LFS: File or Directory is corrupted
     *
     * Generated from protobuf enum <code>FileResult_ErrorCorrupted = 84;</code>
     */
    const FileResult_ErrorCorrupted = 84;
    /**
     * LFS: File or Directory was not found
     *
     * Generated from protobuf enum <code>FileResult_ErrorNotFound = 2;</code>
     */
    const FileResult_ErrorNotFound = 2;
    /**
     * LFS: Indicates the file already exists when trying to write to it
     *
     * Generated from protobuf enum <code>FileResult_ErrorAlreadyExists = 17;</code>
     */
    const FileResult_ErrorAlreadyExists = 17;
    /**
     * LFS: Directory cannot be removed because it is not empty
     *
     * Generated from protobuf enum <code>FileResult_ErrorDirNotEmpty = 39;</code>
     */
    const FileResult_ErrorDirNotEmpty = 39;
    /**
     * LFS: internal error - file number was bad
     *
     * Generated from protobuf enum <code>FileResult_ErrorBadFileNumber = 9;</code>
     */
    const FileResult_ErrorBadFileNumber = 9;
    /**
     * LFS: File is too big for flash
     *
     * Generated from protobuf enum <code>FileResult_ErrorFileTooBig = 27;</code>
     */
    const FileResult_ErrorFileTooBig = 27;
    /**
     * LFS: internal error - Some parameter was incorrect
     *
     * Generated from protobuf enum <code>FileResult_ErrorInvalidParameter = 22;</code>
     */
    const FileResult_ErrorInvalidParameter = 22;
    /**
     * LFS: No flash available to create or write to file
     *
     * Generated from protobuf enum <code>FileResult_ErrorNoSpaceAvailable = 28;</code>
     */
    const FileResult_ErrorNoSpaceAvailable = 28;
    /**
     * LFS: Same as LFS_NOMEM for no memory available
     *
     * Generated from protobuf enum <code>FileResult_ErrorOutOfMemory = 12;</code>
     */
    const FileResult_ErrorOutOfMemory = 12;
    /**
     * LFS: Path is too long to handle
     *
     * Generated from protobuf enum <code>FileResult_ErrorPathTooLong = 36;</code>
     */
    const FileResult_ErrorPathTooLong = 36;

    private static $valueToName = [
        self::FileResult_Ok => 'FileResult_Ok',
        self::FileResult_ErrorIO => 'FileResult_ErrorIO',
        self::FileResult_ErrorCorrupted => 'FileResult_ErrorCorrupted',
        self::FileResult_ErrorNotFound => 'FileResult_ErrorNotFound',
        self::FileResult_ErrorAlreadyExists => 'FileResult_ErrorAlreadyExists',
        self::FileResult_ErrorDirNotEmpty => 'FileResult_ErrorDirNotEmpty',
        self::FileResult_ErrorBadFileNumber => 'FileResult_ErrorBadFileNumber',
        self::FileResult_ErrorFileTooBig => 'FileResult_ErrorFileTooBig',
        self::FileResult_ErrorInvalidParameter => 'FileResult_ErrorInvalidParameter',
        self::FileResult_ErrorNoSpaceAvailable => 'FileResult_ErrorNoSpaceAvailable',
        self::FileResult_ErrorOutOfMemory => 'FileResult_ErrorOutOfMemory',
        self::FileResult_ErrorPathTooLong => 'FileResult_ErrorPathTooLong',
    ];

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

