#ifndef _LI_DUMP_DVD_H
#define _LI_DUMP_DVD_H 1
#include <iostream>
#include <string>
#include <vector>
#include <thread>
#include <mutex>

#include "../Scsi/OpticalDrive.hpp"
#include "../Dvd/DvdRipper.hpp"

namespace Li::Gui {

	class DumpDVD {
	private:
		bool keepPolling;
		bool showDemoWindow;
		bool imRippinIt; // dodododo do do!

		std::mutex* lock;

		int sectorsAtOnce;
		bool decrypt;
		bool discInserted;
		int selectedDrive;
		int selectedDriveSpeed;
		uint32_t counter;
		char outputFile[0x8000];

		std::vector<Li::Scsi::OpticalDrive*>* drivesList;
		std::thread* pollDrives;
		
		Li::Dvd::DvdRipper* dvdRipper;

		void ripDiscThread();
		void pollDrivesThread();

		void freeOldDriveList();
		void refreshDriveList();
		std::string getDrivesStr();
		void reset();

		void startRip();
		void endRipAndGoBackToMenu();

		void showRipMenu();
		void showRippingStatus();

	public:
		Li::Scsi::OpticalDrive* GetCurrentSelectedDrive();
		DumpDVD();
		~DumpDVD();
		void RenderUI();
	};

}
#endif