#include <argh.h>
#include <ISXDK.h>
#include <thread>

#include "ISXMr.h"
#include "Logger.h"
#include "Commands/ExportCommand.h"

enum CommandType {
	Export,
	Test,
	NotDefined
};

CommandType GetCommandType(const std::string &command) {
	if (command == "export" || command == "e") {
		return CommandType::Export;
	} else if (command == "test" || command == "t") {
		return CommandType::Test;
	}
	return CommandType::NotDefined;
}


int CMD_Mr(int argc, char *argv[]) {
	const argh::parser cmdl(argv);
	switch (const auto commandType = GetCommandType(cmdl[1])) {
		case CommandType::Export:
			executor.AddTask(std::make_shared<ExportCommand>());
			break;
		case CommandType::Test:
			log << LogLevel::Info << "Test command" << std::endl;
			break;
		default:
			logw << "USAGE: mr [e|export]: Export abilities" << std::endl;
			break;
	}

	// if (cmdl[{"-e", "--export"}]) {
	// 	executor.AddTask(std::make_shared<ExportCommand>());
	// } else {
	// 	logger << "USAGE: mr [e|export]: Export abilities" << std::endl;
	// }
	return 0;
}
