local lib = LibStub("LibMatic-ChangeLog-1.0", true)

local function buildSpec()
    return {
        title = "CritMatic - Change Log",
        statusText = "For the full changelog, visit CurseForge.",
        version = tostring(Critmatic.newVersion or ""),
        style = (Critmatic.db and Critmatic.db.profile and Critmatic.db.profile.changeLogPopUp) or nil,
        entries = {
            {
                version = "6.18.1",
                date = "06/10/2026",
                sections = {
                    { label = "Performance", body = [[This release is all fixes and smoothing. CritMatic is much lighter during big fights and over long sessions, so the Crit Log and on-screen alerts no longer build up memory the longer you play, and busy raid and dungeon combat is smoother.]] },
                    { label = "Fixed", body = [[Custom alert message formats can no longer cause an error, and spell tooltips on Burning Crusade Classic no longer error. The previous-record line now shows in your language. New healing records again count when your target is a low-level friend or pet. Guild crit announcements now send properly when you are also in a party or raid. Deleting a spell's data clears every rank of that spell and updates tooltips right away. The Crit Log position, the minimap button, and this changelog popup now behave correctly when you switch profiles.]] },
                },
            },
            {
                version = "6.18.0",
                date = "06/09/2026",
                sections = {
                    { label = "Added", body = [[Alerts from all Infinite Loop Alchemist addons can now share one position on screen and stack neatly together, newest on top. It is on by default, and you can turn it off in the alert settings to keep CritMatic's own alert position. A new Max Shared Alerts setting controls how many alerts can be on screen at once in the shared stack, 5 by default. Move the alert position in any one addon and every addon sharing it follows.]] },
                },
            },
            {
                version = "6.17.0",
                date = "06/09/2026",
                sections = {
                    { label = "Added", body = [[Four new options, all off by default. Mute Alerts in Raids and Mute Alerts in Dungeons hide the alert, its sound, and the chat line for new records while you are in those groups, and your records are still tracked. Delay Alerts Until Combat Ends holds your alerts during a fight and shows them all when it ends. Show Best Per Spell After Combat gives you a clean recap of your best new record for each spell when the fight ends.]] },
                },
            },
        },
    }
end

Critmatic.showChangeLog = function()
    if not lib then return end
    lib:Show(buildSpec())
end
