/*
 * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#pragma once

#include <ox/event/signal.hpp>
#include <ox/std/string.hpp>

#include <nostalgia/core/context.hpp>

#include "lib/filedialog.hpp"
#include "lib/task.hpp"

namespace nostalgia {

class FileDialogManager : public nostalgia::studio::Task {
	private:
		enum class UpdateProjectPathState {
				None,
				EnableSystemCursor,
				RunFileDialog,
				Start = EnableSystemCursor,
		} m_state = UpdateProjectPathState::Start;

	public:
		FileDialogManager() noexcept = default;

		template<class... Args>
		explicit FileDialogManager(Args ...args) noexcept {
			pathChosen.connect(args...);
		}

		~FileDialogManager() noexcept override = default;

		nostalgia::studio::TaskState update(nostalgia::core::Context *ctx) noexcept final;

		// signals
		ox::Signal<ox::Error(const ox::String &)> pathChosen;

};

}