/*
 * 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
 */

#pragma once

#include "appwindow.h"
#include "mirai-core/Mirai.h"
#include "mirai-core/TasksView.h"
#include "slint.h"

class UiState
{

  public:
	UiState(mirai::Mirai *mirai);

	void run();

	void reloadSources();
	void reloadTags();
	void reloadTasks();

  private:
	void setupCallbacks();
	void setupTaskWindowCallbacks();
	void setupEventWindowCallbacks();
	void setupUtilsCallbacks();

	std::shared_ptr<slint::VectorModel<slint::SharedString>> sources_;
	std::shared_ptr<slint::VectorModel<slint::SharedString>> tags_;
	std::shared_ptr<slint::VectorModel<Day>> days_;

	slint::ComponentHandle<AppWindow> mainWindow_ = AppWindow::create();
	slint::ComponentHandle<TaskWindow> taskWindow_ = TaskWindow::create();
	slint::ComponentHandle<EventWindow> eventWindow_ = EventWindow::create();

	mirai::Mirai *miraiInstance_;
	mirai::TasksView view_;
};
