-- ============================================================
--  rOrbs - Saved Orb Templates (static built-ins)
-- ============================================================
--  Personal DisplayInfo templates integrated as fixed addon
--  presets so they are always available in the main template
--  dropdown.
--
--  Each saved template is generated automatically from the
--  SAVED_DISPLAY_IDS list below.  Every template is marked
--  with `autoFit = true` so the Template Engine centers the
--  model on its natural camera target and applies the default
--  camera distance (see DEFAULTS below).  The user can zoom
--  in / shift further via the Template Adjustment sliders.
-- ============================================================

local _, ns = ...

local M = "Interface\\AddOns\\rOrbs\\media\\"

if not ns.orbTemplates then return end

local T = ns.orbTemplates

-- ------------------------------------------------------------
-- SAVED DISPLAY IDS
-- ------------------------------------------------------------
local SAVED_DISPLAY_IDS = {
  83867, 90960, 111460, 87635, 76560, 77113, 78710, 111482, 78816, 91803,
  96186, 112851, 75947, 96287, 18402, 112778, 96197, 108172, 85124, 113430,
  92104, 79147, 118685, 94997, 107931, 80318, 101678, 81463, 75542, 86438,
  92774, 20373, 110863, 110092, 101676, 116295, 114465, 101674, 114065, 107938,
  78276, 110050, 101677, 80321, 101323, 99885, 99641, 98158, 78647, 113167,
  74692, 81327, 79212, 42641, 101772, 81399,
}

-- ------------------------------------------------------------
-- DEFAULTS
-- Note on camScale: SMALLER value = model appears LARGER (camera
-- closer). 2.5 gives a comfortably small, centered starting
-- framing. The user can zoom in using the Template Adjustment
-- slider in the GUI if they want the model larger.
-- ------------------------------------------------------------
local DEFAULTS = {
  camScale         = 5.0,
  modelOpacity     = 1,
  posAdjustX       = 0,
  posAdjustY       = 0,
  posAdjustZ       = 0,
  statusBarTexture = M .. "orb_filling16",
  statusBarColor   = {1, 1, 1, 1},
  sparkColor       = {1, 1, 1, 1},
  autoFit          = true,
}

-- ------------------------------------------------------------
-- BUILD TEMPLATES
-- ------------------------------------------------------------
for _, displayID in ipairs(SAVED_DISPLAY_IDS) do
  local key = "saved-" .. tostring(displayID)
  if not T[key] then
    T[key] = {
      label            = "Saved " .. tostring(displayID),
      displayInfoID    = displayID,
      statusBarTexture = DEFAULTS.statusBarTexture,
      statusBarColor   = {DEFAULTS.statusBarColor[1], DEFAULTS.statusBarColor[2], DEFAULTS.statusBarColor[3], DEFAULTS.statusBarColor[4]},
      sparkColor       = {DEFAULTS.sparkColor[1],     DEFAULTS.sparkColor[2],     DEFAULTS.sparkColor[3],     DEFAULTS.sparkColor[4]},
      modelOpacity     = DEFAULTS.modelOpacity,
      camScale         = DEFAULTS.camScale,
      posAdjustX       = DEFAULTS.posAdjustX,
      posAdjustY       = DEFAULTS.posAdjustY,
      posAdjustZ       = DEFAULTS.posAdjustZ,
      autoFit          = DEFAULTS.autoFit,
    }
  end
end

if ns.RebuildOrbTemplateList then
  ns.RebuildOrbTemplateList()
end
