local MER, E, L, V, P, G = unpack(select(2, ...))
local M = MER:GetModule('MER_Media')

local function mediaTable()
	E.Options.args.mui.args.media = {
		order = 40,
		name = MER:cOption(L["Media"], 'gradient'),
		icon = MER.Media.Icons.media,
		type = "group",
		childGroups = "tab",
		get = function(info) return E.db.mui.media[ info[#info] ] end,
		hidden = function() return IsAddOnLoaded("ElvUI_SLE") end,
		args = {
			name = {
				order = 1,
				type = "header",
				name = MER:cOption(L["Media"], 'orange'),
			},
			credits = {
				order = 2,
				type = "group",
				name = MER:cOption(L["Credits"], 'orange'),
				guiInline = true,
				args = {
					tukui = {
						order = 1,
						type = "description",
						fontSize = "medium",
						name = format("|cff9482c9Shadow & Light - Darth Predator|r"),
					},
				},
			},
			zoneText = {
				type = "group",
				name = L["Zone Text"],
				order = 3,
				get = function(info) return E.db.mui.media.zoneText[ info[#info] ] end,
				set = function(info, value) E.db.mui.media.zoneText[ info[#info] ] = value; E:UpdateMedia() end,
				args = {
					intro = {
						order = 0,
						type = "description",
						name = "",
					},
					enable = {
						order = 1,
						type = "toggle",
						name = L["Enable"],
					},
					test = {
						order = 2,
						type = 'execute',
						name = L["Test"],
						disabled = function() return not E.private.general.replaceBlizzFonts or not E.db.mui.media.zoneText.enable end,
						func = function() M:TextShow() end,
					},
					zone = {
						type = "group",
						name = ZONE,
						order = 3,
						guiInline = true,
						get = function(info) return E.db.mui.media.zoneText.zone[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.zoneText.zone[ info[#info] ] = value; E:UpdateMedia() end,
						disabled = function() return not E.private.general.replaceBlizzFonts or not E.db.mui.media.zoneText.enable end,
						args = {
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 48, step = 1,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
							},
						},
					},
					subzone = {
						type = "group",
						name = L["Subzone Text"],
						order = 4,
						guiInline = true,
						get = function(info) return E.db.mui.media.zoneText.subzone[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.zoneText.subzone[ info[#info] ] = value; E:UpdateMedia() end,
						disabled = function() return not E.private.general.replaceBlizzFonts or not E.db.mui.media.zoneText.enable end,
						args = {
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 48, step = 1,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
							},
						},
					},
					pvp = {
						type = "group",
						name = L["PvP Status Text"],
						order = 5,
						guiInline = true,
						get = function(info) return E.db.mui.media.zoneText.pvp[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.zoneText.pvp[ info[#info] ] = value; E:UpdateMedia() end,
						disabled = function() return not E.private.general.replaceBlizzFonts or not E.db.mui.media.zoneText.enable end,
						args = {
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 48, step = 1,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
							},
						},
					},
				},
			},
			miscText = {
				type = "group",
				name = L["Misc Texts"],
				order = 4,
				get = function(info) return E.db.mui.media.miscText[ info[#info] ] end,
				set = function(info, value) E.db.mui.media.miscText[ info[#info] ] = value; E:UpdateMedia() end,
				args = {
					mail = {
						type = "group",
						name = L["Mail Text"],
						order = 1,
						guiInline = true,
						disabled = function() return not E.private.general.replaceBlizzFonts end,
						get = function(info) return E.db.mui.media.miscText.mail[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.miscText.mail[ info[#info] ] = value; E:UpdateMedia() end,
						args = {
							enable = {
								order = 0,
								type = "toggle",
								name = L["Enable"],
							},
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
								disabled = function() return not E.db.mui.media.miscText.mail.enable end,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 22, step = 1,
								disabled = function() return not E.db.mui.media.miscText.mail.enable end,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
								disabled = function() return not E.db.mui.media.miscText.mail.enable end,
							},
						},
					},
					gossip = {
						type = "group",
						name = L["Gossip and Quest Frames Text"],
						order = 2,
						guiInline = true,
						disabled = function() return not E.private.general.replaceBlizzFonts end,
						hidden = not E.Retail,
						get = function(info) return E.db.mui.media.miscText.gossip[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.miscText.gossip[ info[#info] ] = value; E:UpdateMedia() end,
						args = {
							enable = {
								order = 0,
								type = "toggle",
								name = L["Enable"],
							},
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
								disabled = function() return not E.db.mui.media.miscText.gossip.enable end,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 20, step = 1,
								disabled = function() return not E.db.mui.media.miscText.gossip.enable end,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
								disabled = function() return not E.db.mui.media.miscText.gossip.enable end,
							},
						},
					},
					questHeader = {
						type = "group",
						name = L["Objective Tracker Header Text"],
						order = 3,
						guiInline = true,
						disabled = function() return not E.private.general.replaceBlizzFonts end,
						hidden = not E.Retail,
						get = function(info) return E.db.mui.media.miscText.objectiveHeader[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.miscText.objectiveHeader[ info[#info] ] = value; E:UpdateMedia() end,
						args = {
							enable = {
								order = 0,
								type = "toggle",
								name = L["Enable"],
							},
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
								disabled = function() return not E.db.mui.media.miscText.objectiveHeader.enable end,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 20, step = 1,
								disabled = function() return not E.db.mui.media.miscText.objectiveHeader.enable end,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
								disabled = function() return not E.db.mui.media.miscText.objectiveHeader.enable end,
							},
						},
					},
					questTracker = {
						type = "group",
						name = L["Objective Tracker Text"],
						order = 4,
						guiInline = true,
						disabled = function() return not E.private.general.replaceBlizzFonts end,
						hidden = not E.Retail,
						get = function(info) return E.db.mui.media.miscText.objective[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.miscText.objective[ info[#info] ] = value; E:UpdateMedia() end,
						args = {
							enable = {
								order = 0,
								type = "toggle",
								name = L["Enable"],
							},
							font = {
								type = "select", dialogControl = "LSM30_Font",
								order = 1,
								name = L["Font"],
								values = AceGUIWidgetLSMlists.font,
								disabled = function() return not E.db.mui.media.miscText.objective.enable end,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 20, step = 1,
								disabled = function() return not E.db.mui.media.miscText.objective.enable end,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
								disabled = function() return not E.db.mui.media.miscText.objective.enable end,
							},
						},
					},
					questFontSuperHuge = {
						type = "group",
						name = L["Banner Big Text"],
						order = 5,
						guiInline = true,
						disabled = function() return not E.private.general.replaceBlizzFonts end,
						hidden = not E.Retail,
						get = function(info) return E.db.mui.media.miscText.questFontSuperHuge[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.miscText.questFontSuperHuge[ info[#info] ] = value; E:UpdateMedia() end,
						args = {
							enable = {
								order = 0,
								type = "toggle",
								name = L["Enable"],
							},
							font = {
								type = "select", dialogControl = 'LSM30_Font',
								order = 1,
								name = L["Font"],
								desc = "The font used for chat editbox",
								values = AceGUIWidgetLSMlists.font,
								disabled = function() return not E.db.mui.media.miscText.questFontSuperHuge.enable end,
							},
							size = {
								order = 2,
								name = L["Font Size"],
								type = "range",
								min = 6, max = 48, step = 1,
								disabled = function() return not E.db.mui.media.miscText.questFontSuperHuge.enable end,
							},
							outline = {
								order = 3,
								name = L["Font Outline"],
								desc = L["Set the font outline."],
								type = "select",
								values = {
									["NONE"] = L["None"],
									["OUTLINE"] = "OUTLINE",
									["MONOCHROMEOUTLINE"] = "MONOCROMEOUTLINE",
									["THICKOUTLINE"] = "THICKOUTLINE",
								},
								disabled = function() return not E.db.mui.media.miscText.questFontSuperHuge.enable end,
							},
						},
					},
				},
			},
		},
	}
end
tinsert(MER.Config, mediaTable)
