/*
 * Mirai. Copyright (C) 2024 Vyn
 * This file is licensed under version 3 of the GNU General Public License (GPL-3.0-only)
 * The license can be found in the LICENSE file or at https://www.gnu.org/licenses/gpl-3.0.txt
 */

#include "UiState.h"
#include "mirai-core/Config.h"
#include "mirai-core/Mirai.h"
#include "mirai-core/StdFileSource.h"
#include <cstdlib>
#include <string>

int main(int argc, char **argv)
{
	mirai::Config config(std::string(getenv("HOME")) + "/.config/mirai/config.json");

	mirai::Mirai mirai;

	for (const auto &sourceFilePath : config.sources()) {
		auto file = std::make_unique<mirai::StdFileSource>(
			mirai::BaseFileSourceConstructor{.name = sourceFilePath, .path = sourceFilePath}
		);
		mirai.loadSource(std::move(file));
	}

	UiState uiState{&mirai};
	uiState.run();

	return 0;
}
