#include "answer_code.hpp"
#include <stdlib.h>

const char* get_error(uint32_t code) {
    switch (code) {
        case OS_OK:                         return "Successfully";

        case OS_ERR_NO_MEMORY:              return "Error: Out of memory";
        case OS_ERR_NOT_INIT:               return "Error: The object or table is not initialized";
        case OS_ERR_NOT_FOUND:              return "Error: Not found";
        case OS_ERR_INVALID_ARG:            return "Error: Invalid argument";
        case OS_ERR_FULL:                   return "Error: Object is full";
        case OS_ERR_MAGIC:                  return "Error: Unknown file type";
        case OS_WRN_ALREADY_INIT:           return "Warning: Attempting to reinitialize an object";
        case OS_WRN_NOT_NEED_INIT:          return "Warning: Attempt to initialize an uninitializable object";

        case VFS_ERR_TARGET_BUSY:           return "Error: Remounting on busy path";
        case VFS_ERR_NOT_SUPPORTED:         return "Error: FS version not supported";

        case VRAM_ERR_RANGE:                return "Error: Attempt to write/read outside the video memory block";
        case VRAM_ERR_HANDLE:               return "Error: Invalid or non-existent Handle";
        case VRAM_WRN_DEFRAG_REQ:           return "Warning: Defragmentation required to allocate memory";
        case VRAM_ERR_WR_or_RD:             return "Error: Error reading record";
        case VRAM_ERR_POOL_MEMORY:          return "Error: Memory allocation error";

        case PROC_ERR_STACK:                return "Error: There was not enough memory for the task stack.";
        case PROC_ERR_PRIORITY:             return "Error: Invalid FreeRTOS priority";
        case PROC_ERR_ALIVE:                return "Error: Attempting to operate on an already dead process";

        case DISP_ERR_UNSUPPORTED:          return "Error: Screen mode or pixel format not supported";

        default:                            return "Unknown system error";
    }
}