local _, core     = ...;
WC_Lib            = {};
WC_Lib.structures = {};

WC_Lib.structures.CurrentFilters = {true, true, true, true, true, true}; -- Obtenu, Manquant, HF, Mount, Pet, Transmog

WC_Lib.structures.tableAccents      = {};
WC_Lib.structures.tableAccents["À"] = "A";
WC_Lib.structures.tableAccents["Á"] = "A";
WC_Lib.structures.tableAccents["Â"] = "A";
WC_Lib.structures.tableAccents["Ã"] = "A";
WC_Lib.structures.tableAccents["Ä"] = "A";
WC_Lib.structures.tableAccents["Ç"] = "C";
WC_Lib.structures.tableAccents["È"] = "E";
WC_Lib.structures.tableAccents["É"] = "E";
WC_Lib.structures.tableAccents["Ê"] = "E";
WC_Lib.structures.tableAccents["Ë"] = "E";
WC_Lib.structures.tableAccents["Ì"] = "I";
WC_Lib.structures.tableAccents["Í"] = "I";
WC_Lib.structures.tableAccents["Î"] = "I";
WC_Lib.structures.tableAccents["Ï"] = "I";
WC_Lib.structures.tableAccents["Ñ"] = "N";
WC_Lib.structures.tableAccents["Ò"] = "O";
WC_Lib.structures.tableAccents["Ó"] = "O";
WC_Lib.structures.tableAccents["Ô"] = "O";
WC_Lib.structures.tableAccents["Õ"] = "O";
WC_Lib.structures.tableAccents["Ö"] = "O";
WC_Lib.structures.tableAccents["Ù"] = "U";
WC_Lib.structures.tableAccents["Ú"] = "U";
WC_Lib.structures.tableAccents["Û"] = "U";
WC_Lib.structures.tableAccents["Ü"] = "U";
WC_Lib.structures.tableAccents["Ý"] = "Y";



WC_Lib.structures.WCFilterMenu = {
	frameOwner = nil;
	info = {
		{   text = core.L["MountCollected"],
			arg1 = core.L["MountCollected"],
			isNotRadio       = true,
			disabled         = false,
			keepShownOnClick = true,
			checked          = true,
			func = function(self, arg1)
				WC_Lib.structures.CurrentFilters[1]             = not WC_Lib.structures.CurrentFilters[1];
				WC_Lib.structures.WCFilterMenu.info[1].checked = not WC_Lib.structures.WCFilterMenu.info[1].checked;
				WC_Lib.DisplayGuidesByFilter("WC");
			end
		},
		{   text = core.L["MountNotCollected"],
			arg1 = core.L["MountNotCollected"],
			isNotRadio       = true,
			disabled         = false,
			keepShownOnClick = true,
			checked          = true,
			func = function(self, arg1)
				WC_Lib.structures.CurrentFilters[2]             = not WC_Lib.structures.CurrentFilters[2];
				WC_Lib.structures.WCFilterMenu.info[2].checked = not WC_Lib.structures.WCFilterMenu.info[2].checked;
				WC_Lib.DisplayGuidesByFilter("WC");
			end
		},
		{   text = core.L["Catégorie"],
			hasArrow     = true,
			notCheckable = true,
			menuList = {
				{	text = core.L["Challenges"],
					isNotRadio       = true,
					disabled         = false,
					keepShownOnClick = true,
					checked          = true,
					func = function(self)
						WC_Lib.structures.CurrentFilters[3]                         = not WC_Lib.structures.CurrentFilters[3];
						WC_Lib.structures.WCFilterMenu.info[3].menuList[1].checked = not WC_Lib.structures.WCFilterMenu.info[3].menuList[1].checked;
						WC_Lib.DisplayGuidesByFilter("WC");
					end
				},
				{	text = core.L["Mounts"],
					isNotRadio       = true,
					disabled         = false,
					keepShownOnClick = true,
					checked          = true,
					func = function(self)
						WC_Lib.structures.CurrentFilters[4]                         = not WC_Lib.structures.CurrentFilters[4];
						WC_Lib.structures.WCFilterMenu.info[3].menuList[2].checked = not WC_Lib.structures.WCFilterMenu.info[3].menuList[2].checked;
						WC_Lib.DisplayGuidesByFilter("WC");
					end
				},
				{	text = core.L["Pets"],
					isNotRadio       = true,
					disabled         = false,
					keepShownOnClick = true,
					checked          = true,
					func = function(self)
						WC_Lib.structures.CurrentFilters[5]                         = not WC_Lib.structures.CurrentFilters[5];
						WC_Lib.structures.WCFilterMenu.info[3].menuList[3].checked = not WC_Lib.structures.WCFilterMenu.info[3].menuList[3].checked;
						WC_Lib.DisplayGuidesByFilter("WC");
					end
				},
				{   text = core.L["Transmog"],
					isNotRadio       = true,
					disabled         = false,
					keepShownOnClick = true,
					checked          = true,
					func = function(self)
						WC_Lib.structures.CurrentFilters[6]                         = not WC_Lib.structures.CurrentFilters[6];
						WC_Lib.structures.WCFilterMenu.info[3].menuList[4].checked = not WC_Lib.structures.WCFilterMenu.info[3].menuList[4].checked;
						WC_Lib.DisplayGuidesByFilter("WC");
					end
				},
			},
			func = function(self, arg1)
			end
		},
	}
};

WC_Lib.structures.WCGuideMenu = {
	frameOwner = nil;
	info = {
		{	text = core.L["Exporter"],
			arg1 = core.L["Exporter"],
			notCheckable = true,
			disabled = false,
			func = function(self)
				WC_Lib.ShowPopupExport(WC_Lib.structures.WCGuideMenu.frameOwner.idGuide, WC_Lib.structures.WCGuideMenu.frameOwner.addon);
				PlaySound("83", "sfx");
			end
		},
		{   text = core.L["Supprimer"],
			arg1 = core.L["Supprimer"],
			notCheckable = true,
			disabled = false,
			func = function(self, arg1)
				local confirmDialog = StaticPopup_Show("WC_ConfirmDialog", core.L["Voulez-vous supprimer"].." |cFFF5CC00"..WC_Lib.structures.WCGuideMenu.frameOwner.nameGuide.."|r ?\nID: |cff00c8ff"..WC_Lib.structures.WCGuideMenu.frameOwner.idGuide.."|r");
				confirmDialog.func  = function() WC_Lib.DeleteCollection(WC_Lib.structures.WCGuideMenu.frameOwner.idGuide, WC_Lib.structures.WCGuideMenu.frameOwner.addon); end;
				PlaySound("882", "sfx");
			end
		},
	}
};

StaticPopupDialogs["PATREON"] = {
	text = core.L["TextUrl"],
	button1 = core.L["Close"],
	OnShow = function (self, data)
		self.editBox:SetText("https://www.patreon.com/WoWChallenger")
		self.editBox:SetSize(250, 50);
		self.editBox:HighlightText();
	end,
	whileDead = true,
	hasEditBox = true
}

StaticPopupDialogs["DISCORD"] = {
	text = core.L["TextUrl"],
	button1 = core.L["Close"],
	OnShow = function (self, data)
		self.editBox:SetText("https://discord.gg/cc5TGnd")
		self.editBox:SetSize(250, 50);
		self.editBox:HighlightText();
	end,
	whileDead = true,
	hasEditBox = true
}

WC_Lib.structures.WCJoinMenu = {
	info = {
		{	text = "DISCORD",
			notCheckable = true,
			disabled = false,
			func = function(self)
				StaticPopup_Show("DISCORD");
			end
		},
		{	text = "=======",
			isTitle = true,
			notCheckable = true,
			disabled = true,
		},
		{   text = "PATREON",
			notCheckable = true,
			disabled = false,
			func = function(self, arg1)
				StaticPopup_Show("PATREON");
			end
		},
	}
};