local ElvUI_EltreumUI, E, L, V, P, G = unpack(select(2, ...))
local sort = sort
local pairs = pairs
local tinsert = table.insert
local tconcat = table.concat
local ReloadUI = ReloadUI

-- Author list
local AUTHORS = {
	'|c4682B4ffEltreum|r',
}

-- Credits and Thank yous list
local THANKYOU = {
	'|cff0070DEAzilroka|r',
	'|cffC41F3BKringel|r',
	'|cffF58CBARepooc|r',
	'Blazeflack',
	'Botanica',
	'|T134297:15:15:0:0:64:64:5:59:5:59|t |cffff7d0aMerathilis|r',
	'|cff9482c9Darth Predator|r',
	'Caedis',
	'Elv',
	E:TextGradient('Simpy but his name might be shorter sometimes even though he fixes a lot of things', 1,.42,.78, 1,.56,.68, .66,.99,.98, .77,.52,1, 1,.48,.81, .98,.95,.68),
	'Tukui Community',
	'Shrom',
	'Pat',
	'|cff00c0faBenik|r',
	'|T136012:15:15:0:0:64:64:5:59:5:59|t |cff006fdcRubgrsch|r |T656558:15:15:0:0:64:64:5:59:5:59|t',
	'|TInterface/AddOns/ElvUI/Media/ChatLogos/FoxWarlock:15:15:0:0:64:64:5:59:5:59|t |cffff2020NihilisticPandemonium|r',
	'|TInterface/AddOns/ElvUI/Media/ChatLogos/Clover:15:15:0:0:64:64:5:59:5:59|t |cffFF7D0ALuckyone|r  -- Especially for allowing the usage of his installer/plugin as a base',
	'AcidWeb |TInterface/AddOns/ElvUI/Media/ChatLogos/Gem:15:15:-1:2:64:64:6:60:8:60|t',
}

-- SortList
local function SortList(a, b)
	return E:StripString(a) < E:StripString(b)
end

sort(AUTHORS, SortList)
sort(THANKYOU, SortList)

-- Author table
for _, name in pairs(AUTHORS) do
	tinsert(ElvUI_EltreumUI.CreditsList, name)
end
local AUTHORS_STRING = tconcat(AUTHORS, '|n')

-- Thank you table
for _, name in pairs(THANKYOU) do
	tinsert(ElvUI_EltreumUI.CreditsList, name)
end
local THANKYOU_STRING = tconcat(THANKYOU, '|n')

-- EltreumUI ingame options
function ElvUI_EltreumUI:Configtable()

	-- Add EltreumUI version on top of the ElvUI config
	E.Options.name = E.Options.name .. " + " .. ElvUI_EltreumUI.Name .. " ".. ElvUI_EltreumUI.Version
	E.Options.args.ElvUI_EltreumUI = {
		order = 1,
		type = 'group',
		name = ElvUI_EltreumUI.Name,
		args = {
			logo = {
				type = 'description',
				name = "",
				order = 1,
				image = function() return 'Interface\\AddOns\\ElvUI_EltreumUI\\Media\\Textures\\logohq', 512, 128 end,
			},
			installer = {
				order = 2,
				type = 'group',
				name = 'Installer',
				args = {
					install = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Reinstall the plugin',
						args = {
							generalVars = {
								order = 1,
								type = 'execute',
								name = 'Install',
								func = function() E:GetModule('PluginInstaller'):Queue(ElvUI_EltreumUI.InstallerData); E:ToggleOptionsUI(); end,
							},
						},
					},
				},
			},
			aurafilters = {
				type = 'group',
				name = 'Aura Filters',
				order = 3,
				args = {
					header1 = {
						order = 1,
						type = 'header',
						name = 'Aura Filters',
					},
					listofauras = {
						order = 19,
						type = 'input',
						width = 'full',
						name = 'Import aura filters by copying the code below and going into Profiles > Import Profile.',
						get = function() return ' ' end,
					},
				},
			},
			profiles = {
				type = 'group',
				name = 'Addon Profiles',
				order = 4,
				args = {
					plugins = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'ElvUI Plugins',
						args = {
							addonskins = {
								order = 1,
								type = 'execute',
								name = '|cff16C3F2AddOn|r|cFFFFFFFFSkins|r',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupAS(); ReloadUI(); end,
								confirm = true,
							},
							projectazilroka = {
								order = 2,
								type = 'execute',
								name = '|cFF16C3F2Project|r|cFFFFFFFFAzilroka|r',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupPA(); ReloadUI(); end,
								confirm = true,
							},
						},
					},
					bossmods = {
						order = 2,
						type = 'group',
						inline = true,
						name = 'BossMods Profiles',
						args = {
							bigwigs = {
								order = 1,
								type = 'execute',
								name = 'BigWigs',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupBW(); ReloadUI(); end,
								confirm = true,
							},
							dbm = {
								order = 2,
								type = 'execute',
								name = 'DBM',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupDBM(); ReloadUI(); end,
								confirm = true,
							},
						},
					},
					addons = {
						order = 4,
						type = 'group',
						inline = true,
						name = 'Addon Profiles',
						args = {
							dynamiccam = {
								order = 1,
								type = 'execute',
								name = 'Dynamic Cam',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupDynamicCam(); ReloadUI(); end,
								confirm = true,
							},
							immersion = {
								order = 2,
								type = 'execute',
								name = 'Immersion',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupImmersion(); ReloadUI(); end,
								confirm = true,
							},
							gladiusex = {
								order = 3,
								type = 'execute',
								name = 'Gladius Ex',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupGladiusEx(); ReloadUI(); end,
								confirm = true,
							},
							exorsus = {
								order = 4,
								type = 'execute',
								name = 'Exorsus Raid Tools',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupExRT(); ReloadUI(); end,
								confirm = true,
							},
							nameplatesct = {
								order = 5,
								type = 'execute',
								name = 'Nameplate Scrolling Combat Text',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupNameplateSCT(); ReloadUI(); end,
								confirm = true,
							},
							fct = {
								order = 6,
								type = 'execute',
								name = 'Floating Combat Text',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupFCT(); ReloadUI(); end,
								confirm = true,
							},
							details = {
								order = 7,
								type = 'execute',
								name = 'Details',
								desc = 'Reset to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:AddonSetupDT(); ReloadUI(); end,
								confirm = true,
							},
						},
					},
				},
			},
			procglow = {
				type = 'group',
				name = 'Custom Glow',
				order = 5,
				args = {
					glow = {
						type = 'group',
						name = 'Toggle a Custom Glow',
						guiInline = true,
						order = 10,
						args = {
							enable = {
							type = 'toggle',
							name = 'Enable',
							order = 1,
							get = function() return E.private.ElvUI_EltreumUI.glow.enable end,
							set = function(_, value) E.private.ElvUI_EltreumUI.glow.enable = value; E:StaticPopup_Show('PRIVATE_RL') end,
							},
							addagaphere = {
							order = 2,
							type = "description",
							name = "",
							},
							addanothergapforfun = {
							order = 2,
							type = "description",
							name = "",
							},
							procselection = {
							order = 2,
							type = 'group',
							name = 'Select a Type',
								args = {
									yetanothergap = {
									order = 2,
									type = "description",
									name = "",
									},
									autocast = {
										type = 'toggle',
										name = 'Autocast',
										order = 10,
										desc = 'Adds an autocast style glow using class color',
										disabled = function() return not E.private.ElvUI_EltreumUI.glow.enable or E.private.ElvUI_EltreumUI.glow.pixel or E.private.ElvUI_EltreumUI.glow.blizzard end,
										get = function(info) return E.private.ElvUI_EltreumUI.glow.autocast end,
										set = function(info, value) E.private.ElvUI_EltreumUI.glow.autocast = value; E:StaticPopup_Show('PRIVATE_RL') end,
									},
									pixel = {
										type = 'toggle',
										name = 'Pixel',
										order = 12,
										desc = 'Adds a pixel style glow using class color',
										disabled = function() return not E.private.ElvUI_EltreumUI.glow.enable or E.private.ElvUI_EltreumUI.glow.autocast or E.private.ElvUI_EltreumUI.glow.blizzard end,
										get = function(info) return E.private.ElvUI_EltreumUI.glow.pixel end,
										set = function(info, value) E.private.ElvUI_EltreumUI.glow.pixel = value; E:StaticPopup_Show('PRIVATE_RL') end,
									},
									blizzard = {
										type = 'toggle',
										name = 'Blizzard',
										order = 11,
										desc = 'Adds a Blizzard style glow using class color',
										disabled = function() return not E.private.ElvUI_EltreumUI.glow.enable or E.private.ElvUI_EltreumUI.glow.autocast or E.private.ElvUI_EltreumUI.glow.pixel end,
										get = function(info) return E.private.ElvUI_EltreumUI.glow.blizzard end,
										set = function(info, value) E.private.ElvUI_EltreumUI.glow.blizzard = value; E:StaticPopup_Show('PRIVATE_RL') end,
									},
								},
							},
						},
					},
				},
			},
			cvars = {
				order = 6,
				type = 'group',
				name = 'CVars',
				args = {
					setup = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Setup CVars',
						args = {
							generalVars = {
								order = 1,
								type = 'execute',
								name = 'General CVars',
								func = function() ElvUI_EltreumUI:SetupCVars(); end,
								confirm = true,
							},
						},
					},
					generalDesc = {
						order = 2,
						type = 'group',
						inline = true,
						name = 'General CVars',
						args = {
							cvars = {
								order = 1,
								type = 'description',
								fontSize = 'medium',
								name = '- autoLootDefault true\n- cameraDistanceMaxZoomFactor 2.6\n- nameplateLargerScale 1.2\n- nameplateMaxDistance 60\n- nameplateMinAlpha 1\n- nameplateMinScale 1\n- nameplateMotion 1\n- nameplateOccludedAlphaMult 0\n- nameplateOverlapH 0.8\n- nameplateOverlapV 1.1\n- nameplateSelectedScale 1\n- nameplateSelfAlpha 1\n- nameplateShowFriendlyMinions 0\n- removeChatDelay 1\n- UnitNameEnemyGuardianName 0\n- UnitNameEnemyMinionName 0\n- UnitNameEnemyPetName 0\n- UnitNameEnemyPlayerName 1\n- UnitNameEnemyTotem 1',
							},
						},
					},
				},
			},
			partyraidsettings = {
				type = 'group',
				name = 'Party/Raid',
				order = 84,
				args = {
					partyraiddeath = {
						type = 'group',
						name = 'Play a sound when someone dies in Party or Raid',
						guiInline = true,
						order = 10,
						args = {
							enable = {
							type = 'toggle',
							name = 'Enable',
							order = 1,
							get = function() return E.private.ElvUI_EltreumUI.partyraiddeath.enable end,
							set = function(_, value) E.private.ElvUI_EltreumUI.partyraiddeath.enable = value end,
							},
							addagaphere = {
							order = 2,
							type = "description",
							name = "",
							},
							addanothergapforfun = {
							order = 2,
							type = "description",
							name = "",
							},
							soundselection = {
							order = 2,
							type = 'group',
							name = 'Select a Sound',
								args = {
									yetanothergap = {
									order = 2,
									type = "description",
									name = "",
									},
									bruh = {
										type = 'toggle',
										name = 'Bruh',
										order = 5,
										disabled = function() return not E.private.ElvUI_EltreumUI.partyraiddeath.enable or E.private.ElvUI_EltreumUI.partyraiddeath.robloxoof or E.private.ElvUI_EltreumUI.partyraiddeath.shame or E.private.ElvUI_EltreumUI.partyraiddeath.wow end,
										get = function(info) return E.private.ElvUI_EltreumUI.partyraiddeath.bruh end,
										set = function(info, value) E.private.ElvUI_EltreumUI.partyraiddeath.bruh = value end,
									},
									robloxoof = {
										type = 'toggle',
										name = 'Oof',
										order = 6,
										disabled = function() return not E.private.ElvUI_EltreumUI.partyraiddeath.enable or E.private.ElvUI_EltreumUI.partyraiddeath.bruh or E.private.ElvUI_EltreumUI.partyraiddeath.shame or E.private.ElvUI_EltreumUI.partyraiddeath.wow end,
										get = function(info) return E.private.ElvUI_EltreumUI.partyraiddeath.robloxoof end,
										set = function(info, value) E.private.ElvUI_EltreumUI.partyraiddeath.robloxoof = value end,
									},
									yetanothergap2 = {
									order = 8,
									type = "description",
									name = "",
									},
									shame = {
										type = 'toggle',
										name = 'Shame',
										order = 13,
										disabled = function() return not E.private.ElvUI_EltreumUI.partyraiddeath.enable or E.private.ElvUI_EltreumUI.partyraiddeath.bruh or E.private.ElvUI_EltreumUI.partyraiddeath.robloxoof or E.private.ElvUI_EltreumUI.partyraiddeath.wow end,
										get = function(info) return E.private.ElvUI_EltreumUI.partyraiddeath.shame end,
										set = function(info, value) E.private.ElvUI_EltreumUI.partyraiddeath.shame = value end,
									},
									wowsound = {
										type = 'toggle',
										name = 'Wow',
										order = 14,
										disabled = function() return not E.private.ElvUI_EltreumUI.partyraiddeath.enable or E.private.ElvUI_EltreumUI.partyraiddeath.bruh or E.private.ElvUI_EltreumUI.partyraiddeath.robloxoof or E.private.ElvUI_EltreumUI.partyraiddeath.shame  end,
										get = function(info) return E.private.ElvUI_EltreumUI.partyraiddeath.wow end,
										set = function(info, value) E.private.ElvUI_EltreumUI.partyraiddeath.wow = value end,
									},

								},
							},
						},
					},
				},
			},

			waypointsetting = {
				type = 'group',
				name = 'Maps',
				order = 82,
				args = {
					waypointetasetting = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Add a time to arrive below the waypoint',
						get = function(info) return E.private.ElvUI_EltreumUI.waypointetasetting[info[#info]] end,
						set = function(info, value) E.private.ElvUI_EltreumUI.waypointetasetting[info[#info]] = value; E:StaticPopup_Show('PRIVATE_RL') end,
						args = {
							explainer = {
								order = 1,
								type = "description",
								name = 'The memory usage of Eltruism will appear to increase but this is just a reflection of the memory usage of the SuperTrackedFrame.',
							},
							explainer2 = {
								order = 2,
								type = "description",
								name = '',
							},
							explainer3 = {
								order = 3,
								type = "description",
								name = 'The memory value will automatically reset since that is how Blizzard coded it. And the memory usage of Eltruism includes the memory usage of Blizzards SuperTrackedFrame',
							},
							explainer4 = {
								order = 4,
								type = "description",
								name = '',
							},

							enable = {
								order = 5,
								type = 'toggle',
								name = 'Enable',
								desc = 'Add an ETA to waypoints',
							},
						},
					},
				},
			},

			media = {
				type = 'group',
				name = 'Media',
				order = 83,
				args = {
					defaults = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Fonts, Textures & Skins',
						args = {
							private = {
								order = 1,
								type = 'execute',
								name = 'Reset Media',
								desc = 'Reset Fonts, Textures, Skins to Eltreum UI defaults.',
								func = function() ElvUI_EltreumUI:SetupPrivate(); E:StaggeredUpdateAll(nil, true) end,
								confirm = true,
							},
						},
					},
				},
			},
			nameplatescolors = {
				type = 'group',
				name = 'Nameplate',
				order = 83,
				args = {
					nameplateOptions = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Toggle Colored Class Borders & Glow',
						get = function(info) return E.private.ElvUI_EltreumUI.nameplateOptions[info[#info]] end,
						set = function(info, value) E.private.ElvUI_EltreumUI.nameplateOptions[info[#info]] = value; E:StaticPopup_Show('PRIVATE_RL') end,
						args = {
							classhover = {
								order = 1,
								type = 'toggle',
								name = 'Class color hover',
								desc = 'Change the color of the hover to be class colored',
								get = function(info) return E.private.ElvUI_EltreumUI.nameplateOptions.ClassColorGlow end,
								set = function(info, value) E.private.ElvUI_EltreumUI.nameplateOptions.ClassColorGlow = value; E:StaticPopup_Show('PRIVATE_RL') end,
							},
							classborder = {
								order = 2,
								type = 'toggle',
								name = 'Class color border',
								desc = 'Change the color of the border glow to be class bordered in nameplates',
								get = function(info) return E.private.ElvUI_EltreumUI.nameplateOptions.ClassBorderNameplate end,
								set = function(info, value) E.private.ElvUI_EltreumUI.nameplateOptions.ClassBorderNameplate = value; E:StaticPopup_Show('PRIVATE_RL') end,
							},
						},
					},
					addsomegap = {
							order = 2,
							type = "description",
							name = "",
					},
					friendlynameplate = {
						order = 2,
						type = 'group',
						inline = true,
						name = 'Show Friendly Nameplates Outside Instances, hide inside instances',
						args = {
							desc = {
								order = 1,
								type = 'toggle',
								name = 'Enable',
								desc = 'Toogle On and Off',
								get = function() return E.private.ElvUI_EltreumUI.friendlynameplatetoggle.enable end,
								set = function(_, value) E.private.ElvUI_EltreumUI.friendlynameplatetoggle.enable = value end,
							},
					}
				},
			},
			},
			stealthOptionssetting = {
				type = 'group',
				name = 'Stealth Vignette',
				order = 85,
				args = {
					stealthOptions = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Toggle a Stealth Effect',
						get = function(info) return E.private.ElvUI_EltreumUI.stealthOptions[info[#info]] end,
						set = function(info, value) E.private.ElvUI_EltreumUI.stealthOptions[info[#info]] = value; E:StaticPopup_Show('PRIVATE_RL') end,
						args = {
							stealthoptions = {
								order = 1,
								type = 'toggle',
								name = 'Enable',
								desc = 'Add a vignette while in stealth',
								get = function(info) return E.private.ElvUI_EltreumUI.stealthOptions.stealtheffect end,
								set = function(info, value) E.private.ElvUI_EltreumUI.stealthOptions.stealtheffect = value; E:StaticPopup_Show('PRIVATE_RL') end,
							},
						},
					},
				},
			},
			racialafkmusic = {
				type = 'group',
				name = 'AFK',
				order = 3,
				args = {
					afkmusic = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Play a music of your character race while AFK',
						get = function(info) return E.private.ElvUI_EltreumUI.afkmusic[info[#info]] end,
						set = function(info, value) E.private.ElvUI_EltreumUI.afkmusic[info[#info]] = value;end,
						args = {
							afktoggle = {
								order = 1,
								type = 'toggle',
								name = 'Enable',
								desc = 'Play music while AFK',
								get = function(info) return E.private.ElvUI_EltreumUI.afkmusic.enable end,
								set = function(info, value) E.private.ElvUI_EltreumUI.afkmusic.enable = value; end,
							},
						},
					},
				},
			},
			weakauras = {
				type = 'group',
				name = 'WeakAuras',
				order = 96,
				args = {
					header1 = {
						order = 1,
						type = 'header',
						name = 'WeakAuras',
					},
					affixes = {
						order = 19,
						type = 'input',
						width = 'normal',
						name = 'My Weakauras are available here, but they are mostly upcoming features',
						get = function() return 'wago.io/p/Eltreum' end,
					},
				},
			},

			credits = {
				type = 'group',
				name = 'Credits',
				order = 98,
				args = {
					author = {
						order = 1,
						type = 'group',
						inline = true,
						name = 'Author',
						args = {
							desc = {
								order = 1,
								type = 'description',
								fontSize = 'medium',
								name = AUTHORS_STRING,
							},
						},
					},
					thankyou = {
						order = 2,
						type = 'group',
						inline = true,
						name = 'Credits and Thank yous',
						args = {
							desc = {
								order = 1,
								type = 'description',
								fontSize = 'medium',
								name = THANKYOU_STRING,
							},
						},
					},
				},
			},
			support = {
				type = 'group',
				name = 'Support',
				order = 99,
				args = {
					changelog = {
						order = 1,
						type = 'input',
						width = 'full',
						name = 'New commits, basically a preview of fixes or upcoming features',
						get = function() return 'https://git.tukui.org/eltreum/eltruism/-/commits/master' end,
					},
					issues = {
						order = 2,
						type = 'input',
						width = 'full',
						name = 'Report issues and problems here:',
						get = function() return 'https://git.tukui.org/eltreum/eltruism/-/issues' end,
					},
					tukui = {
						order = 3,
						type = 'input',
						width = 'full',
						name = 'Addon on tukui:',
						get = function() return 'https://www.tukui.org/addons.php?id=209' end,
					},
					curse = {
						order = 4,
						type = 'input',
						width = 'full',
						name = 'Addon on curse:',
						get = function() return 'https://www.curseforge.com/wow/addons/elvui-eltruism' end,
					},
				},
			},
		},
	}

	for _, func in pairs(ElvUI_EltreumUI.Config) do
		func()
	end
end
