#pragma once
#include "CBaseMode.h"
#include "CUserInfo.h"
#include "CServerList.h"
#include "CVersion.h"
#include "CSysConfig.h"

enum struct PROXY_MODE {

	sys_mode = 0,
	tun_mode,

};


enum struct ROUT_MODE{

	cn_mode = 0,
	qg_mode,

};

struct SysMode {
	int id;
	PROXY_MODE proxy_mode;
	SStringW  name;
};

struct RouteMode {
	int id;
	ROUT_MODE route_mode;
	SStringW  name;
};

class CApp : public SSingleton<CApp>
{
public:
	CApp();
	~CApp();

	void Init();

	void UnInit();

	CSysConfig* CApp::GetSysconfig();
	CUserInfo* GetUserinfo();
	CServerList* GetServerList();
	CVersion* GetVerinfo();

	void SetOut(int out);

	int GetOut();

	void SetSysMode(PROXY_MODE mode);

	PROXY_MODE GetSysMode();

	void SetRouteMode(ROUT_MODE mode);

	ROUT_MODE GetRouteMode();

	void SetMethod(HINSTANCE hinst);

	HINSTANCE GetMethod();
	
	//¼ì²â»òÕßÉèÖÃDataÄ¿Â¼
	void ChkeAndSetDtaPath();

	bool CheckOnlyOneInstance() noexcept;

	std::filesystem::path GetDataPath();
	std::filesystem::path GetConfigPath();
	std::filesystem::path GetConfigGuiPath();

	void SetupDataDirectory();

	void SetCLashRuning(bool m);

	bool GetClashRuning();

 

	std::string GetToken() const { return m_token; }
	void SetToken(std::string val) { m_token = val; }
	std::string GetSelect_node() const;
	void SetSelect_node(std::string val);
private:
	int m_is_out;
	CServerList* m_server_list;
	CUserInfo* m_userinfo;
	CVersion* m_versioninfo;
	CSysConfig* m_sys_config;
	PROXY_MODE m_proxy_mode;
	ROUT_MODE  m_route_mode;
	HINSTANCE  m_hInst;
	std::filesystem::path m_dataPath;
	std::filesystem::path m_configPath;
	std::filesystem::path m_config_Gui_Path;

	bool m_clashRuning = true;
	std::string m_token;
	/**/
	std::string select_node;
};

