/*
 * 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 "SettingsWindow.h"
#include "../../SeleniteSetup.h"
#include "evalyte-cpp-common/evalyte.h"
#include "mirai-core/DataProvider.h"
#include "mirai-core/MarkdownDataProvider.h"
#include "mirai-core/Mirai.h"
#include "slint.h"
#include "slint_string.h"
#include <bits/chrono.h>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <memory>
#include <optional>
#include <print>
#include <string>

SettingsWindow::SettingsWindow(mirai::Mirai *miraiInstance) : miraiInstance_(miraiInstance)
{

	const auto palettePath = std::string(getenv("HOME")) + "/.config/evalyte/theme.json";
	const auto palette = selenite::parseJson(palettePath);

	if (palette.has_value()) {
		setSelenitePalette(window_->global<ui::Palette>(), palette.value());
	}

	setupCallbacks();
}

void SettingsWindow::setupCallbacks()
{
}

void SettingsWindow::open()
{
	window_->show();
}

void SettingsWindow::close()
{
	window_->hide();
}
