--[[----------------------------------------------------------------------------
  A7InfoLRProvider.lua

  LrPluginInfoProvider: liefert den Inhalt des Plugin-Manager-Abschnitts.
------------------------------------------------------------------------------]]

local LrView = import 'LrView'

local A7InfoLRProvider = {}

-- Unterstuetzte Modelle analog TA7File::isValidModel() in a7file.cpp.
local SUPPORTED = {
    { series = "Alpha 1",            models = "A1, A1 II" },
    { series = "Alpha 7",            models = "A7 II, A7 III, A7 IV, A7 V" },
    { series = "Alpha 7R",           models = "A7R II, A7R III/IIIA, A7R IV/IVA, A7R V, A7R VI" },
    { series = "Alpha 7S",           models = "A7S II, A7S III" },
    { series = "Alpha 7C",           models = "A7C, A7C II, A7CR" },
    { series = "Alpha 9",            models = "A9, A9 II, A9 III" },
    { series = "Alpha 6x00 (APS-C)", models = "A6100, A6300, A6400, A6500, A6600, A6700" },
}

function A7InfoLRProvider.sectionsForTopOfDialog(viewFactory, propertyTable)
    local f = viewFactory
    local version = (_PLUGIN and _PLUGIN.version and _PLUGIN.version.display) or "0.1.1"

    local modelRows = {}
    for _, entry in ipairs(SUPPORTED) do
        modelRows[#modelRows + 1] = f:row {
            spacing = f:label_spacing(),
            f:static_text {
                title          = entry.series .. ":",
                width_in_chars = 24,
                font           = "<system/small>",
            },
            f:static_text {
                title = entry.models,
                font  = "<system/small>",
            },
        }
    end

    return {
        {
            title = "A7InfoLR",

            f:column {
                spacing = f:control_spacing(),

                f:row {
                    f:static_text {
                        title = "Version " .. version .. "  –  © 2026 Wolfram Soens",
                        font  = "<system/bold>",
                    },
                },

                f:static_text {
                    title = "Zeigt AF-Punkte, Aufnahmeeinstellungen und Sony-MakerNotes"
                         .. " fuer Sony-Alpha-Kameras in Lightroom Classic an."
                         .. " Basiert auf A7Info (macOS-Desktop-App).",
                    height_in_lines = 2,
                },

                f:separator { fill_horizontal = 1 },

                f:static_text {
                    title = "Unterstuetzte Kameras:",
                    font  = "<system/bold>",
                },

                f:column(modelRows),
            },
        },
    }
end

return A7InfoLRProvider
