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

#pragma once

#include <ox/std/string.hpp>

#include <studio/context.hpp>

#include <studio/widget.hpp>

namespace studio {

class MakeCopyPopup: public Widget {
 	private:
		enum class Stage {
			Closed,
			Opening,
			Open,
		};
		Stage m_stage = Stage::Closed;
		bool m_open{};
		ox::String m_errMsg;
		ox::String m_title{"Copy File"};
		ox::String m_srcPath;
		ox::String m_dirPath;
		ox::IString<255> m_fileName;

	public:
		ox::Signal<ox::Error(ox::StringViewCR src, ox::StringViewCR dst)> makeCopy;

		ox::Error open(ox::StringViewCR path) noexcept;

		void close() noexcept;

		[[nodiscard]]
		bool isOpen() const noexcept;

		void draw(Context &ctx) noexcept override;

	private:
		void accept(Context const &ctx) noexcept;
};

}
