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.33.0",
                date = "07/01/2026",
                sections = {
                    { label = "Added", body = [[You can now show off any recorded crit whenever you like. Right-click a spell in the Crit Log, pick Share, and choose where to send it: party, raid, battleground, guild, yell, emote, or a whisper to anyone you name. Only the channels you can actually use right now appear.]] },
                },
            },
            {
                version = "6.32.0",
                date = "06/30/2026",
                sections = {
                    { label = "Social", body = [[Sending your crits and hits to guild chat is now off by default. Turn it back on anytime in the Social options; party and raid sharing are unchanged.]] },
                },
            },
            {
                version = "6.31.1",
                date = "06/30/2026",
                sections = {
                    { label = "Changed", body = [[Updated the RepMatic and MailMatic icons in the "More Infinite Loop Alchemist Addons" list to their new artwork, and added XPMatic to that list.]] },
                },
            },
            {
                version = "6.31.0",
                date = "06/23/2026",
                sections = {
                    { label = "Added", body = [[New Colors tab: set one shared color palette and apply it to your alerts, the Crit Log, and the data-bar displays all at once, with a switch on each so it can follow the shared colors or keep its own. Your pet's records can now be colored on your alerts and in the Crit Log too, each with its own crit and hit color pickers, not just on the data bar.]] },
                    { label = "Changed", body = [[The pet color that used to be called "Pet Value" is now called "Pet Hit", to match the wording used everywhere else.]] },
                },
            },
            {
                version = "6.30.0",
                date = "06/22/2026",
                sections = {
                    { label = "Added", body = [[You can now give each data-bar display its own icon. New dropdowns on the Broker tab let you pick a different icon for your Damage, Healing, and Pet displays, so you can tell them apart at a glance even with the labels hidden. There are also new color pickers for your pet's crit and value numbers, and the records window and combined tooltip now keep your pet's abilities together in their own Pet group. Previewing your alert position now shows a sample crit alert so it matches the real thing.]] },
                    { label = "Changed", body = [[Your data-bar displays now follow your tooltip color settings. The Healing display uses your heal colors and the Damage display uses your damage colors, and your custom spell name and heal colors finally show up where they didn't before.]] },
                    { label = "Fixed", body = [[The previous best shown for a spell that has more than one rank could be wrong, showing a smaller old number instead of your real last record. It now always shows your true previous best.]] },
                },
            },
            {
                version = "6.29.0",
                date = "06/20/2026",
                sections = {
                    { label = "Added", body = [[Your records now show up on item tooltips. Hover a potion, healthstone, or any on-use item, or click its link in chat, and you'll see your best crit, hit, and heal for what that item does, just like the records already shown on your spell tooltips. Items you have no record for stay clean.]] },
                    { label = "Fixed", body = [[The separate Damage, Healing, and Pet data-bar displays now look like the main one: your top crit and top hit together, in your colors, and as short as you've set your main display. Before, each showed just a single plain number with no way to tell a crit from a hit.]] },
                },
            },
            {
                version = "6.28.0",
                date = "06/18/2026",
                sections = {
                    { label = "Added", body = [[Eleven new fonts are now bundled in. You can pick them anywhere CritMatic lets you choose a font (your alerts, the Crit Log, and the minimap tooltip): Capital Hill, Capital Hill Monospaced, Extra Thick, Extra Thick Monospaced, Fabled Font, Fabled Font Monospaced, High Birth More Letter Gap, Scrambled Eggs, Scrambled Eggs Bold, Tomorrow Night, and Tomorrow Night Monospaced.]] },
                },
            },
        },
    }
end

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