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.8.0",
                date = "05/31/2026",
                sections = {
                    { label = "Added", body = [[Records now show up in your pet's ability tooltips, just like your own spells. CritMatic also has a minimap button now, and shows up on info bars like Titan Panel: left-click opens the Crit Log, right-click opens the options. And there's a new option to stop recording records on grey-level mobs and critters, just turn on "Ignore Grey-Level Targets" in the General options.]] },
                    { label = "Changed", body = [[New records now show your previous best and how much you beat it by, like (prev 11200, +1145). You can turn this off in the General options. Guild crit announcements are also spaced at least a minute apart now, so CritMatic won't spam your guild.]] },
                },
            },
            {
                version = "6.7.0",
                date = "05/31/2026",
                sections = {
                    { label = "Changed", body = [[New highest crits are now shared to your guild chat by default. If you'd rather keep them to yourself, just turn off "Send Crits to Guild" in the Social settings. If you already changed that setting before, your choice is kept.]] },
                },
            },
            {
                version = "6.6.0",
                date = "05/22/2026",
                sections = {
                    { label = "Changed", body = [[You can now position your alert text by dragging it. In the Alert Notifications settings, click "Position Alert" and a draggable preview appears on screen, using the same font and color you'll see in combat. Drag it where you want it and confirm. The old X and Y sliders are gone; Reset Position and Test Position still work the same.]] },
                },
            },
        },
    }
end

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