#pragma once
#include "../../Backend/Globalincludes.h"
#include "../../Backend/Misc/singleton.h"
#include "../Framework/MenuFramework.h"
#include <unordered_map>
#include <vector>
#include <string>

// Launch exePath as a non-elevated process (de-elevate from admin).
// Returns true on success, false if fallback (ShellExecuteW) is needed.
bool LaunchAsNonElevated(const wchar_t* exePath);

class CMenu : public singleton<CMenu>
{
public:
	void Initialize();
	void Draw();

	bool IsMenuOpened();
	void SetMenuOpened(bool v);

	RLColor GetMenuColor();

	int Menu_key = VK_INSERT;

private:
	// Animation & layout
	bool HandleAlpha();
	void HandleLayout();
	void SaveLayout();

	// Program control
	void RestartAsAdmin();
	void RestartProgram();
	void ExitProgram();

	// Tab rendering
	void DrawTabButtons();
	void Tab1();
	void Tab2();
	void RendererTab();
	void Tab4();
	void SettingTab();
	void Tab6();
	void Tab7();
	void ConfigTab();

	// Whitelist helpers
	void RefreshWindowList(std::vector<std::string>& windowList, std::vector<const char*>& windowListPtrs);
	void AddToWhitelist(const std::string& name);
	void RemoveFromWhitelist(const std::string& name);

	bool m_bInitialized = false;
	bool m_bIsOpened = false;
	int m_nCurrentTab = 0;
	int m_nCurrentLegitTab = 0;
};