-- ============================================================
--  rOrbs – Orb Templates (based on rOrbTemplate by zork)
-- ============================================================
--  Preset orb model configurations. Each template defines:
--    displayInfoID  - the 3D model's DisplayInfo ID
--    camScale       - camera distance scale
--    modelOpacity   - model alpha (0–1)
--    statusBarColor - fill color {r,g,b,a}
--    sparkColor     - spark overlay color {r,g,b,a}
--    statusBarTexture - fill texture path
--    pos/pan adjust - camera positioning offsets
--
--  Integration: rOrbs reads ns.orbTemplates in the GUI to offer
--  a dropdown. Selecting a template applies the model settings
--  and optionally the fill texture/color to the selected orb.
-- ============================================================

local _, ns = ...

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

ns.orbTemplates = {}
local T = ns.orbTemplates

-- Sorted display list (built once at the end)
ns.orbTemplateList = nil

-------------------------------------------------
-- TEMPLATE DEFINITIONS
-------------------------------------------------

T["magenta-matrix"] = {
  label = "Magenta Matrix",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {.6, 0, .6, 1},
  sparkColor = {.8, 0, .8, 1},
  modelOpacity = 1,
  displayInfoID = 113764,
  camScale = 0.8,
}

T["deep-purple-starly"] = {
  label = "Deep Purple Starly",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {.6, 0, .6, 1},
  sparkColor = {.5, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 65947,
  camScale = 0.9,
}

T["art-chtun-eye"] = {
  label = "C'Thun Eye",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {.6, 0.3, 0, 1},
  sparkColor = {0.7, .2, 0, 1},
  modelOpacity = 1,
  displayInfoID = 94285,
  camScale = 0.73,
}

T["magenta-swirly"] = {
  label = "Magenta Swirly",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {.6, 0, .6, 1},
  sparkColor = {.8, 0, .8, 1},
  modelOpacity = 1,
  displayInfoID = 88991,
  camScale = 6,
}

T["art-azeroth"] = {
  label = "Azeroth",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {1, 1, 1, 1},
  sparkColor = {0.8, 1, 0.9, 1},
  modelOpacity = 1,
  displayInfoID = 44652,
  camScale = 1,
  posAdjustY = -0.03,
}

T["deep-purple-magic"] = {
  label = "Deep Purple Magic",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {.1, 0.1, .5, 1},
  sparkColor = {0.2, 0.1, .8, 1},
  modelOpacity = 1,
  displayInfoID = 80318,
  camScale = 0.8,
}

T["sandy-blitz"] = {
  label = "Sandy Blitz",
  statusBarTexture = M .. "orb_filling4",
  statusBarColor = {0.4, 0, .6, 1},
  sparkColor = {0.5, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 76935,
  camScale = 0.625,
  posAdjustZ = -0.18,
  panAdjustZ = 1.25,
}

T["blue-aqua-swirly"] = {
  label = "Blue Aqua Swirly",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.2, 0, 1, 1},
  sparkColor = {0, 0.4, 1, 1},
  modelOpacity = 1,
  displayInfoID = 75294,
  camScale = 5,
  posAdjustZ = -1.5,
  panAdjustZ = 1.5,
}

T["golden-marble"] = {
  label = "Golden Marble",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.7, 0.5, 0, 1},
  sparkColor = {1, 0.75, 0, 1},
  modelOpacity = 1,
  displayInfoID = 74840,
  camScale = 1,
}

T["art-wierd-eye"] = {
  label = "Weird Eye",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0.1, 0.1, 1},
  sparkColor = {1, 0.4, 0.4, 1},
  modelOpacity = 1,
  displayInfoID = 69879,
  camScale = 0.69,
  posAdjustZ = -6.9,
  panByPosAdjustZ = true,
}

T["pink-portal"] = {
  label = "Pink Portal",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.4, 0, 0.6, 1},
  sparkColor = {0.7, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 66092,
  camScale = 2.4,
  posAdjustZ = -1.05,
  panAdjustZ = 1.25,
}

T["green-portal"] = {
  label = "Green Portal",
  statusBarTexture = M .. "orb_filling10",
  statusBarColor = {0, 0.6, 0, 1},
  sparkColor = {0.8, 1, 0, 1},
  modelOpacity = 1,
  displayInfoID = 66202,
  camScale = 2.4,
  posAdjustZ = -1.05,
  panAdjustZ = 1.25,
}

T["blue-portal"] = {
  label = "Blue Portal",
  statusBarTexture = M .. "orb_filling6",
  statusBarColor = {0, 0.4, 0.6, 1},
  sparkColor = {0, .8, 1, 1},
  modelOpacity = 1,
  displayInfoID = 64697,
  camScale = 2.4,
  posAdjustZ = -1.05,
  panAdjustZ = 1.25,
}

T["red-portal"] = {
  label = "Red Portal",
  statusBarTexture = M .. "orb_filling6",
  statusBarColor = {1, 0.1, 0.1, 1},
  sparkColor = {1, 0, 0, 1},
  modelOpacity = 1,
  displayInfoID = 64562,
  camScale = 2.4,
  posAdjustZ = -1.05,
  panAdjustZ = 1.25,
}

T["purple-portal"] = {
  label = "Purple Portal",
  statusBarTexture = M .. "orb_filling10",
  statusBarColor = {0.6, 0, 0.6, 1},
  sparkColor = {.8, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 58948,
  camScale = 2.1,
  posAdjustZ = -1.05,
  panAdjustZ = 1.25,
}

T["red-slob"] = {
  label = "Red Slob",
  statusBarTexture = M .. "orb_filling12",
  statusBarColor = {1, 0.1, 0.1, 1},
  sparkColor = {1, 0, 0, 1},
  modelOpacity = 1,
  displayInfoID = 60225,
  camScale = 1.4,
}

T["green-buzz"] = {
  label = "Green Buzz",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.1, 0.6, 0, 1},
  sparkColor = {0.4, 1, 0, 1},
  modelOpacity = 1,
  displayInfoID = 75298,
  camScale = .6,
  panAdjustX = 1.3,
  panAdjustZ = 1.55,
}

T["purple-buzz"] = {
  label = "Purple Buzz",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0, 0.6, 1},
  sparkColor = {.8, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 48109,
  camScale = .6,
  panAdjustX = 1.3,
  panAdjustZ = 1.55,
}

T["blue-buzz"] = {
  label = "Blue Buzz",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0, 0, 0.6, 1},
  sparkColor = {0, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 48106,
  camScale = .6,
  panAdjustX = 1.3,
  panAdjustZ = 1.55,
}

T["white-cloud"] = {
  label = "White Cloud",
  statusBarTexture = M .. "orb_filling4",
  statusBarColor = {.4, .4, .4, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 42938,
  camScale = 3.5,
  posAdjustY = -0.2,
}

T["blue-magic-swirly"] = {
  label = "Blue Magic Swirly",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.3, 0.4, .6, 1},
  sparkColor = {0.5, 0.8, 1, 1},
  modelOpacity = 1,
  displayInfoID = 39581,
  camScale = 4,
  posAdjustX = -5.5,
  panByPosAdjustZ = true,
}

T["green-beam"] = {
  label = "Green Beam",
  statusBarTexture = M .. "orb_filling10",
  statusBarColor = {0.3, 0.7, 0, 1},
  sparkColor = {0.8, 1, 0, 1},
  modelOpacity = 0.8,
  displayInfoID = 39316,
  camScale = 4,
}

T["white-heal"] = {
  label = "White Heal",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.1, 0.1, 0.1, 1},
  sparkColor = {0.8, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 34404,
  camScale = 1,
}

T["red-heal"] = {
  label = "Red Heal",
  statusBarTexture = M .. "orb_filling1",
  statusBarColor = {0.6, 0.1, 0.1, 1},
  sparkColor = {1, 0, 0, 1},
  modelOpacity = 1,
  displayInfoID = 33853,
  camScale = 1,
}

T["white-pearl"] = {
  label = "White Pearl",
  statusBarTexture = M .. "orb_filling15",
  statusBarColor = {1, 1, 1, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 32368,
  camScale = 0.9,
  panAdjustX = 1.5,
  panAdjustZ = 0.7,
}

T["white-swirly"] = {
  label = "White Swirly",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.1, 0.1, 0.1, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 29286,
  camScale = 3.8,
  posAdjustZ = -1.5,
  panAdjustZ = 1.5,
}

T["purple-warlock-portal"] = {
  label = "Warlock Portal",
  statusBarTexture = M .. "orb_filling6",
  statusBarColor = {0.5, 0.5, 1, 1},
  sparkColor = {0.5, 0.5, 1, 1},
  modelOpacity = 1,
  displayInfoID = 29074,
  camScale = 2.1,
  posAdjustZ = -1.05,
  panAdjustZ = 1.25,
}

T["purple-hole"] = {
  label = "Purple Hole",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.4, 0, 0.6, 1},
  sparkColor = {0.7, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 28460,
  camScale = 3.8,
  posAdjustZ = -1.7,
  panAdjustZ = 1.5,
}

T["blue-swirly"] = {
  label = "Blue Swirly",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0, 0, 0.4, 1},
  sparkColor = {0.2, 0.8, 1, 1},
  modelOpacity = 1,
  displayInfoID = 27393,
  camScale = 4.5,
  posAdjustZ = -1.5,
  panAdjustZ = 1.5,
}

T["sand-storm"] = {
  label = "Sand Storm",
  statusBarTexture = M .. "orb_filling6",
  statusBarColor = {0.6, 0.5, 0, 1},
  sparkColor = {1, 0.9, 0, 1},
  modelOpacity = 1,
  displayInfoID = 18877,
  camScale = 2.7,
  posAdjustZ = -1.6,
  panAdjustZ = 1.5,
}

T["art-el-machina"] = {
  label = "El Machina",
  statusBarTexture = M .. "orb_filling17",
  statusBarColor = {0.6, 0.3, 0, 1},
  sparkColor = {0.7, 0.3, 0, 1},
  modelOpacity = 1,
  displayInfoID = 100018,
  camScale = 2.5,
}

T["red-blue-knot"] = {
  label = "Red Blue Knot",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {.7, 0, 0, 1},
  sparkColor = {1, 0.1, 0, 1},
  modelOpacity = 1,
  displayInfoID = 93977,
  camScale = 2.2,
  posAdjustZ = -1.7,
  panAdjustZ = 2,
}

T["blue-ring-disco"] = {
  label = "Blue Ring Disco",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0, 0, 0.6, 1},
  sparkColor = {0, 0.1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 91994,
  camScale = .9,
}

T["art-dwarf-machina"] = {
  label = "Dwarf Machina",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0.2, 0, 1},
  sparkColor = {1, 0.5, 0, 1},
  modelOpacity = 1,
  displayInfoID = 38699,
  camScale = 0.45,
}

T["circle-rune"] = {
  label = "Circle Rune",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.4, 0.2, .6, 1},
  sparkColor = {0.8, 0.5, 1, 1},
  modelOpacity = 1,
  displayInfoID = 120816,
  camScale = .48,
}

T["purple-storm"] = {
  label = "Purple Storm",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.5, 0.15, 1, 1},
  sparkColor = {0.5, 0.15, 1, 1},
  modelOpacity = 1,
  displayInfoID = 118264,
  camScale = 4.4,
}

T["white-boulder"] = {
  label = "White Boulder",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0.6, 0.6, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 0.7,
  displayInfoID = 109622,
  camScale = 1.05,
  posAdjustZ = -0.5,
  panAdjustZ = 1.5,
}

T["white-snowstorm"] = {
  label = "White Snowstorm",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0.6, 0.6, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 108191,
  camScale = 1.1,
}

T["fire-dot"] = {
  label = "Fire Dot",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0.2, 0, 1},
  sparkColor = {1, 0.5, 0, 1},
  modelOpacity = 1,
  displayInfoID = 108172,
  camScale = 1,
  posAdjustZ = -1.5,
  panAdjustZ = 1.5,
}

T["purple-discoball"] = {
  label = "Purple Discoball",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0, 0.6, 1},
  sparkColor = {.8, 0, 1, 1},
  modelOpacity = 1,
  displayInfoID = 107088,
  camScale = 10.6,
}

T["white-tornado"] = {
  label = "White Tornado",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.1, 0.1, 0.1, 1},
  sparkColor = {.5, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 106201,
  camScale = 7,
  posAdjustZ = -6,
}

T["white-snowglobe"] = {
  label = "White Snowglobe",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.5, 0.5, 0.5, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 101968,
  camScale = 1,
}

T["white-zebra"] = {
  label = "White Zebra",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.5, 0.5, 0.5, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 101272,
  camScale = 1,
  posAdjustZ = -0.1,
}

T["white-spark"] = {
  label = "White Spark",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0, 0, 0, 1},
  sparkColor = {1, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 100007,
  camScale = 1,
}

T["blue-aqua-spark"] = {
  label = "Blue Aqua Spark",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0, 0.1, 0.2, 1},
  sparkColor = {0.3, 0.9, 1, 1},
  modelOpacity = 1,
  displayInfoID = 98573,
  camScale = 1,
}

T["purple-growup"] = {
  label = "Purple Growup",
  statusBarTexture = M .. "orb_filling6",
  statusBarColor = {0.5, 0.2, 0.6, 1},
  sparkColor = {.8, 0.3, 1, 1},
  modelOpacity = 1,
  displayInfoID = 95410,
  camScale = 7,
}

T["blue-aqua-sink"] = {
  label = "Blue Aqua Sink",
  statusBarTexture = M .. "orb_filling15",
  statusBarColor = {0, 0.1, 0.2, 1},
  sparkColor = {0.3, 0.9, 1, 1},
  modelOpacity = 1,
  displayInfoID = 95935,
  camScale = 6,
}

T["pink-portal-swirl"] = {
  label = "Pink Portal Swirl",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {0.3, 0.1, 0.6, 1},
  sparkColor = {1, 0.4, 1, 1},
  modelOpacity = 1,
  displayInfoID = 92626,
  camScale = 2,
  posAdjustZ = -1.15,
  panAdjustZ = 1.5,
}

T["purple-earth"] = {
  label = "Purple Earth",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {0.3, 0.1, 0.6, 1},
  sparkColor = {1, 0.4, 1, 1},
  modelOpacity = 0.8,
  displayInfoID = 92612,
  camScale = 1.05,
  posAdjustZ = -0.06,
}

T["golden-earth"] = {
  label = "Golden Earth",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {0.7, 0.5, 0, 1},
  sparkColor = {1, 0.75, 0, 1},
  modelOpacity = 0.8,
  displayInfoID = 92613,
  camScale = 1.05,
  posAdjustZ = -0.06,
}

T["green-earth"] = {
  label = "Green Earth",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {0.3, 0.7, 0, 1},
  sparkColor = {0.8, 1, 0, 1},
  modelOpacity = 0.8,
  displayInfoID = 92614,
  camScale = 1.05,
  posAdjustZ = -0.06,
}

T["pink-earth"] = {
  label = "Pink Earth",
  statusBarTexture = M .. "orb_filling21",
  statusBarColor = {0.3, 0.1, 0.6, 1},
  sparkColor = {1, 0.4, 1, 1},
  modelOpacity = 0.8,
  displayInfoID = 90499,
  camScale = 1.05,
  posAdjustZ = -0.06,
}

T["golden-tornado"] = {
  label = "Golden Tornado",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.6, 0.2, 0, 1},
  sparkColor = {1, 0.5, 0, 1},
  modelOpacity = 1,
  displayInfoID = 89106,
  camScale = 4.5,
  rotation = 1.9,
  posAdjustY = 0.8,
  posAdjustZ = -1.6,
  panAdjustY = 1.5,
  panAdjustZ = 1.5,
}

T["blue-electric"] = {
  label = "Blue Electric",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.4, 1, 1, 1},
  sparkColor = {0.4, 1, 1, 1},
  modelOpacity = 1,
  displayInfoID = 90127,
  camScale = 0.7,
}

T["blue-splash"] = {
  label = "Blue Splash",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.3, 0.5, .8, 1},
  sparkColor = {0.3, 0.5, 1, 1},
  modelOpacity = 1,
  displayInfoID = 84936,
  camScale = 0.6,
}

T["art-elvish-object"] = {
  label = "Elvish Object",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.3, 0.5, .8, 1},
  sparkColor = {0.3, 0.5, 1, 1},
  modelOpacity = 1,
  displayInfoID = 70769,
  camScale = 0.41,
  adjustRotationByValue = true,
}

T["blue-magic-tornado"] = {
  label = "Blue Magic Tornado",
  statusBarTexture = M .. "orb_filling16",
  statusBarColor = {0.2, 0, 1, 1},
  sparkColor = {0, 0.4, 1, 1},
  modelOpacity = 1,
  displayInfoID = 56959,
  camScale = 4,
  posAdjustZ = -0.5,
  posAdjustY = 0.25,
  panAdjustY = -0.5,
  panAdjustZ = -1,
}

T["none"] = {
  label = "None (Custom)",
  displayInfoID = 0,
  camScale = 1,
  modelOpacity = 0,
  statusBarColor = {1, 1, 1, 1},
  sparkColor = {1, 1, 1, 1},
}

-------------------------------------------------
-- BUILD SORTED LIST
-------------------------------------------------
function ns.RebuildOrbTemplateList()
  local list = {}
  for key, data in pairs(T) do
    if key ~= "none" then
      table.insert(list, { key = key, label = data.label or key })
    end
  end
  table.sort(list, function(a, b) return a.label < b.label end)
  table.insert(list, 1, { key = "none", label = "None (Custom)" })
  ns.orbTemplateList = list
end

ns.RebuildOrbTemplateList()
