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.27.0",
                date = "06/18/2026",
                sections = {
                    { label = "Added", body = [[CritMatic now has separate Damage, Healing, and Pet displays for your data bar, each with its own shorter list. Your pet's records get their own Pet display, kept apart from your damage. You can also turn on a separate minimap button for any of the three from the Broker tab in the options; they all start off.]] },
                    { label = "Fixed", body = [[When you beat a record, the alert and chat now show your previous best even if it was set on a different rank of the spell, the same way the records window already did.]] },
                    { label = "Changed", body = [[A new record now only counts when you truly beat your best for that spell across all of its ranks. Leveling a spell to a new rank and then landing a smaller hit no longer pops a false new record.]] },
                },
            },
            {
                version = "6.26.0",
                date = "06/17/2026",
                sections = {
                    { label = "Added", body = [[You can now change the font, size, and outline of the minimap tooltip. The controls are on the Broker tab in the appearance options.]] },
                    { label = "Changed", body = [[The minimap tooltip now uses the game's default font instead of Anton. You can switch it to any font you like on the Broker tab.]] },
                },
            },
            {
                version = "6.25.0",
                date = "06/16/2026",
                sections = {
                    { label = "Changed", body = [[The Record Threshold now decides whether a new record is kept, not just whether it is announced. A hit only becomes your record when it beats your current one by at least the set percent, and smaller improvements are skipped. The default is now 5%.]] },
                },
            },
        },
    }
end

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