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

#pragma once

#include <ox/event/signal.hpp>

#include <nostalgia/core/context.hpp>

namespace nostalgia::studio {

enum class TaskState {
	Running,
	Done
};

class Task: public ox::SignalHandler {
	public:
		ox::Signal<ox::Error()> finished;
		~Task() noexcept override = default;
		virtual TaskState update(nostalgia::core::Context *ctx) noexcept = 0;
};

class TaskRunner {
	private:
		ox::Vector<ox::UniquePtr<studio::Task>> m_tasks;
	public:
		void update(core::Context *ctx) noexcept;
		void add(Task *task) noexcept;
};

}
