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.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.]] },
                },
            },
            {
                version = "6.16.0",
                date = "06/08/2026",
                sections = {
                    { label = "Added", body = [[Picking a sound in settings now plays it right away, so you can hear each one before you choose.]] },
                    { label = "Changed", body = [[The sound list is cleaner with no duplicate entries, a couple of sounds were renamed, and the alert sounds are louder. Resetting a profile now asks you to confirm first, on both the Profiles tab and the Crit Records tab.]] },
                },
            },
            {
                version = "6.15.1",
                date = "06/08/2026",
                sections = {
                    { label = "Added", body = [[Each Infinite Loop Alchemist addon now shows a short description in the More Infinite Loop Alchemist Addons section of the settings, so you can see what each one does at a glance.]] },
                },
            },
        },
    }
end

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