local E, L, V, P, G = unpack(ElvUI);
local mPlugin = "mMediaTag"
local mMT = E:GetModule(mPlugin);
local mSkin = E:GetModule("Skins")
local addon, ns = ...

--Lua functions
local format = format

--Variables
local ChangelogDate = "15.09.2021"
local ChangelogText = "|CFFE74C3CIMPORTANT! INFO - I have changed the texture names, so the textures are better ordered and it is easier to see which ones belong together. By the way, I added some new ones and sorted out some. If you miss a texture, just let me know.\n\nSorry again for that.|r\n\n\n## [ver. 2.68] - 15.09.2021\n|CFF58D68D### Added|r\n- Currency Dataext Icone postition is now dependent on the text justify\n- NEW Texture Names and many new Textures, Sorry for new Names, but so it is clearer and easier to see what belongs together\n- New Tags mQuestIcon, mPowerPercent\n- New Key words for tell Covenant in Chat !cov, !covenant\n- New Option for Currencys if zero\n|CFF58D68D### Update|r\n- Removed MaUI Profile Support, ther will be an extra Addon\n- Removed Tags with no need: mClass:space-left, mClass:space-right, mClass:short-space-left, mClass:short-space-right"

function mMT:Changelog(opt)
	local Frame = CreateFrame("Frame", "mMediaTagChangelog", E.UIParent, 'BackdropTemplate')
	Frame:Point("CENTER")
	Frame:Size(400, 500)
	Frame:CreateBackdrop("Transparent")
	Frame:SetMovable(true)
	Frame:EnableMouse(true)
	Frame:RegisterForDrag("LeftButton")
	Frame:SetScript("OnDragStart", Frame.StartMoving)
	Frame:SetScript("OnDragStop", Frame.StopMovingOrSizing)
	Frame:SetClampedToScreen(true)
	Frame.mLogo = Frame:CreateTexture(nil, "ARTWORK")
	Frame.mLogo:Point("TOPLEFT", 72, -2)
	Frame.mLogo:Point("BOTTOMRIGHT", -72, 434)
	Frame.mLogo:SetTexture("Interface\\AddOns\\ElvUI_mMediaTag\\media\\textures\\logo.tga")

	local Font = GameFontHighlightSmall:GetFont()

	local Label1 = Frame:CreateFontString(Frame, "OVERLAY", "GameTooltipText")
	Label1:SetFont(Font, 18)
	Label1:SetPoint("TOPRIGHT", -20, -70)
	Label1:SetText(ChangelogDate)
	
	local Label2 = Frame:CreateFontString(Frame, "OVERLAY", "GameTooltipText")
	Label2:SetFont(Font, 18)
	Label2:SetPoint("TOPLEFT", 20, -70)
	Label2:SetText(format("%s%s|r", ns.mColor6, L["Changelog:"]))
	
	local Label3 = Frame:CreateFontString(Frame, "OVERLAY", "GameTooltipText")
	Label3:SetFont(Font, 14)
	Label3:SetPoint("TOPLEFT", 20, -100)
	Label3:SetWidth(360)
	Label3:SetText(ChangelogText)
	
	local Close = CreateFrame("Button", "CloseButton", Frame, "OptionsButtonTemplate, BackdropTemplate")
	Close:Point("BOTTOM", Frame, "BOTTOM", 0, 10)
	Close:SetText(CLOSE)
	Close:Size(80, 20)
	Close:SetScript("OnClick", function()
		E.db[mPlugin].mPluginVersion = ns.mVersion
		Frame:Hide()
		
		if opt then
			E:Config_OpenWindow()
		end
	end)
	
	mSkin:HandleButton(Close)
	
	if opt then
		E.Libs.AceConfigDialog:Close('ElvUI')
	end
end