--[[--------------------------------------------------------------------
  PaladinHolyPower – ui/settings_panel/buttons.lua
  Button definitions (ElvUI/tab-style), dynamic config for any settings panel.
----------------------------------------------------------------------]]

local PHP = _G.PaladinHolyPower
if not PHP then return end

Buttons = Buttons or {}

-- ======================= BUTTON CONFIG TABLE =======================
local CONF = {
  edit_mode = {
    label = "Edit Mode",
    onClick = function(self, PHP, S)
      if PHP.ToggleEditMode then PHP.ToggleEditMode() end
    end,
    tipTitle = "Edit Mode",
    tipText  = "Unlock various elements of the UI to be repositioned."
  },
  -- Add more buttons here as needed!
}

-- ======================= BUTTON CREATION UTILITY =======================
-- x, y, width, height are all *optional* and forwarded to the component
function Buttons.AddButton(parent, PHP, S, x, y, key, width, height)
  local cfg = CONF[key]; if not cfg then return end
  local btn = PHP.CreateStyledButton(
    parent, cfg.label, x or 0, y or 0, width, height,
    function(self)
      if cfg.onClick then cfg.onClick(self, PHP, S) end
    end
  )
  -- Tooltip support
  if btn and cfg.tipTitle and cfg.tipText and PHP.Tooltip and PHP.Tooltip.Attach then
    PHP.Tooltip.Attach(btn, cfg.tipTitle, cfg.tipText)
  end
  return btn
end

-- Make Buttons global for use in any file
_G.Buttons = Buttons
return Buttons