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

#pragma once

#include <ox/event/signal.hpp>

#include <studio/filetreemodel.hpp>
#include <studio/widget.hpp>

namespace studio {

class ProjectExplorer final: public FileExplorer {

	public:
		// slots
		ox::Signal<ox::Error(ox::StringViewCR)> fileChosen;
		ox::Signal<ox::Error(ox::StringViewCR)> addItem;
		ox::Signal<ox::Error(ox::StringViewCR)> addDir;
		ox::Signal<ox::Error(ox::StringViewCR)> deleteItem;
		ox::Signal<ox::Error(ox::StringViewCR)> renameItem;
		ox::Signal<ox::Error(ox::StringViewCR)> makeCopy;
		ox::Signal<ox::Error(ox::StringViewCR)> getInfo;
		ox::Signal<ox::Error(ox::StringViewCR src, ox::StringViewCR dst)> moveDir;
		ox::Signal<ox::Error(ox::StringViewCR src, ox::StringViewCR dst)> moveItem;

		explicit ProjectExplorer(keel::Context &kctx) noexcept;

		ox::Error refreshProjectTreeModel(ox::StringViewCR = {}) noexcept;

	protected:
		void fileOpened(ox::StringViewCR path) const noexcept override;

		void fileDeleted(ox::StringViewCR path) const noexcept override;

		void fileMoved(ox::StringViewCR src, ox::StringViewCR dst) const noexcept override;

		void dirMoved(ox::StringViewCR src, ox::StringViewCR dst) const noexcept override;

		void fileContextMenu(ox::StringViewCR path) const noexcept override;

		void dirContextMenu(ox::StringViewCR path) const noexcept override;

};

}
