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

local function mediaTable()
	E.Options.args.mui.args.media = {
		type = "group",
		name = L["Media"],
		order = 40,
		childGroups = "tab",
		get = function(info) return E.db.mui.media[ info[#info] ] end,
		disabled = function() return IsAddOnLoaded("ElvUI_SLE") end,
		args = {
			name = {
				order = 1,
				type = "header",
				name = MER:cOption(L["Media"]),
			},
			credits = {
				order = 2,
				type = "group",
				name = MER:cOption(L["Credits"]),
				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",
								},
							},
							width = {
								order = 4,
								name = L["Width"],
								type = "range",
								min = 512, max = E.eyefinity or E.screenwidth, step = 1,
								set = function(info, value) E.db.mui.media.zoneText.zone.width = value; M:TextWidth() end,
							},
						},
					},
					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",
								},
							},
							width = {
								order = 4,
								name = L["Width"],
								type = "range",
								min = 512, max = E.eyefinity or E.screenwidth, step = 1,
								set = function(info, value) E.db.mui.media.fonts.subzone.width = value; M:TextWidth() end,
							},
						},
					},
					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",
								},
							},
							width = {
								order = 4,
								name = L["Width"],
								type = "range",
								min = 512, max = E.eyefinity or E.screenwidth, step = 1,
								set = function(info, value) E.db.mui.media.fonts.pvp.width = value; M:TextWidth() end,
							},
						},
					},
				},
			},
			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,
							},
						},
					},
					editbox = {
						type = "group",
						name = L["Chat Editbox Text"],
						order = 2,
						guiInline = true,
						disabled = function() return not E.private.general.replaceBlizzFonts end,
						get = function(info) return E.db.mui.media.miscText.editbox[ info[#info] ] end,
						set = function(info, value) E.db.mui.media.miscText.editbox[ info[#info] ] = value; E:UpdateMedia() end,
						args = {
							enable = {
								order = 1,
								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.editbox.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.editbox.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.editbox.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,
						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,
						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,
						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,
						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)
