
  ---------------------------------------------
  --  rOrbs - db
  ---------------------------------------------

  -- Database (DB)

  ---------------------------------------------

  --get the addon namespace
  local addon, ns = ...

  --object container
  local db = CreateFrame("Frame")
  ns.db = db
  db.default = {}
  db.list = {}

  local wipe    = wipe
  local tinsert = tinsert
  local tremove = tremove
  local strlower = strlower

  ---------------------------------------------
  --DEFAULTS
  ---------------------------------------------

  --default orb setup
  function db:GetOrbDefaults()
    return {
      --health
      ["HEALTH"] = {
        --filling  (#120202)
        filling = {
          texture     = "Interface\\AddOns\\rOrbs\\media\\orb_filling16",
          color       = { r = 0.071, g = 0.008, b = 0.008, },
          colorAuto   = false,
        },
        --model
        model = {
          enable            = true,
          displayInfo       = 33853,
          camDistanceScale  = 1.606,
          pos_x             = 0,
          pos_y             = 0.1,
          rotation          = 0,
          portraitZoom      = 0,
          alpha             = 1.0,
        },
        --galaxies
        galaxies = {
          alpha = 1.0,
        },
        --bubbles
        bubbles = {
          alpha = 1.0,
        },
        --spark
        spark = {
          alpha = 1.0,
        },
        --highlight
        highlight = {
          alpha = 1.0,
        },
        --value
        value = {
          hideOnEmpty = true,
          hideOnFull = false,
          alpha = 1,
          top = {
            color = { r = 1, g = 1, b = 1, },
            tag = "topdef",
          },
          bottom = {
            color = { r = 0.8, g = 0.8, b = 0.8, },
            tag = "botdef",
          },
        },
      },--health end
      --power  (#003659)
      ["POWER"] = {
        --filling
        filling = {
          texture     = "Interface\\AddOns\\rOrbs\\media\\orb_filling16",
          color       = { r = 0.0, g = 0.212, b = 0.349, },
          colorAuto   = false,
        },
        --model
        model = {
          enable            = true,
          displayInfo       = 32368,
          camDistanceScale  = 0.95,
          pos_x             = 0,
          pos_y             = 0.1,
          rotation          = 0,
          portraitZoom      = 0,
          alpha             = 0.70,
        },
        --galaxies
        galaxies  = {
          alpha = 1.0,
        },
        --bubbles
        bubbles = {
          alpha = 1.0,
        },
        --spark
        spark = {
          alpha = 1.0,
        },
        --highlight
        highlight = {
          alpha = 1.0,
        },
        --value
        value = {
          hideOnEmpty = true,
          hideOnFull = false,
          alpha = 1,
          top = {
            color = { r = 1, g = 1, b = 1, },
            tag = "topdef",
          },
          bottom = {
            color = { r = 0.8, g = 0.8, b = 0.8, },
            tag = "botdef",
          },
        },
      },--power end
      --target health  (#780200)
      ["TARGET_HEALTH"] = {
        filling = {
          texture     = "Interface\\AddOns\\rOrbs\\media\\orb_filling16",
          color       = { r = 0.471, g = 0.008, b = 0.0, },
          colorAuto   = false,
        },
        model = {
          enable            = false,
          displayInfo       = 33853,
          camDistanceScale  = 1.606,
          pos_x             = 0,
          pos_y             = 0.1,
          rotation          = 0,
          portraitZoom      = 0,
          alpha             = 1.0,
        },
        galaxies  = { alpha = 0.45, },
        bubbles   = { alpha = 0.30, },
        spark     = { alpha = 1.0,  },
        highlight = { alpha = 1.0,  },
        value = {
          hideOnEmpty = true,
          hideOnFull = false,
          alpha = 1,
          top    = { color = { r = 1, g = 1, b = 1, }, tag = "topdef", },
          bottom = { color = { r = 0.8, g = 0.8, b = 0.8, }, tag = "botdef", },
        },
      },--target health end
      --target-of-target health  (#4a3500)
      ["TOT_HEALTH"] = {
        filling = {
          texture     = "Interface\\AddOns\\rOrbs\\media\\orb_filling16",
          color       = { r = 0.290, g = 0.208, b = 0.0, },
          colorAuto   = false,
        },
        model = {
          enable            = false,
          displayInfo       = 33853,
          camDistanceScale  = 1.606,
          pos_x             = 0,
          pos_y             = 0.1,
          rotation          = 0,
          portraitZoom      = 0,
          alpha             = 1.0,
        },
        galaxies  = { alpha = 0.45, },
        bubbles   = { alpha = 0.30, },
        spark     = { alpha = 1.0,  },
        highlight = { alpha = 1.0,  },
        value = {
          hideOnEmpty = true,
          hideOnFull = false,
          alpha = 1,
          top    = { color = { r = 1, g = 1, b = 1, }, tag = "topdef", },
          bottom = { color = { r = 0.8, g = 0.8, b = 0.8, }, tag = "botdef", },
        },
      },--tot health end
    } --default end
  end

  --load the default config on loadup so the rest can initialize, the view will get updated later once the saved variables are fetched
  db.char = db:GetOrbDefaults()

  --default template
  function db:GetTemplateDefaults()
    return {
      ["pearl"] = {
        --filling
        filling = {
          texture     = "Interface\\AddOns\\rOrbs\\media\\orb_filling15",
          color       = { r = 0.8, g = 0.8, b = 1, },
          colorAuto   = false, --automatic coloring based on class/powertype
        },
        --model
        model = {
          enable            = true,
          displayInfo       = 32368,
          camDistanceScale  = 0.95,
          pos_x             = 0,
          pos_y             = 0.1,
          rotation          = 0,
          portraitZoom      = 0,
          alpha             = 1,
        },
		--galaxies
        galaxies = {
          alpha = 0,
        },
		--bubbles
        bubbles = {
          alpha = 0,
        },
        --spark
        spark = {
          alpha = 0.9,
        },
        --highlight
        highlight = {
          alpha = 0.3,
        },
        --value
        value = {
          hideOnEmpty = true,
          hideOnFull = false,
          alpha = 1,
          top = {
            color = { r = 1, g = 1, b = 1, },
            tag = "topdef",
          },
          bottom = {
            color = { r = 0.8, g = 0.8, b = 0.8, },
            tag = "botdef",
          },
        },
      },
    }
  end

  function db:GetTemplateListDefaults()
    return {
      { value = "pearl", key = "pearl", notCheckable = true, keepShownOnClick = false, },
    }
  end

  ---------------------------------------------
  --LOAD SAVED VARIABLES
  ---------------------------------------------

  --db script on variables loaded
  db:SetScript("OnEvent", function(self, event)
    if rOrbs_DB_GLOB and rOrbs_DB_GLOB.reset then
      rOrbs_DB_GLOB.reset = nil
      rOrbs_DB_GLOB = db:GetTemplateDefaults()
      rOrbs_DB_GLOB.TEMPLATE_LIST = db:GetTemplateListDefaults()
    end
    --load global data
    self.loadGlobalData()
    --load character data
    if not rOrbs_DB_CHAR then
      self.loadCharacterDataDefaults()
    else
      self.loadCharacterData()
    end
    self:UnregisterEvent("VARIABLES_LOADED")
  end)
  db:RegisterEvent("VARIABLES_LOADED")

  ---------------------------------------------
  --DB RESET
  ---------------------------------------------

  --full template reset
  db.resetTemplates = function()
    rOrbs_DB_GLOB.reset = true
    ReloadUI()
  end

  ---------------------------------------------
  --CHARACTER DATA
  ---------------------------------------------
  local function SafeUpdateOrbView()
    -- no-op: GUI panel removed
  end

  --load character data defaults
  db.loadCharacterDataDefaults = function(type)
    local data = db:GetOrbDefaults()
    if type then
      if type == "HEALTH" then
        rOrbs_DB_CHAR[type] = data[type]
        if ns.GUI then ns.GUI:ChatMsg("Health orb reset to default.") end
      elseif type == "POWER" then
        rOrbs_DB_CHAR[type] = data[type]
        if ns.GUI then ns.GUI:ChatMsg("Power orb reset to default.") end
      end
    else
      rOrbs_DB_CHAR = data
      if ns.GUI then ns.GUI:ChatMsg("Character data reset to default.") end
    end
    db.char = rOrbs_DB_CHAR
    --update the orb view
    SafeUpdateOrbView()

  end

  --load character data
  db.loadCharacterData = function()
    db.char = rOrbs_DB_CHAR
    -- Ensure TARGET_HEALTH exists (backward compat with old saved variables)
    if not db.char["TARGET_HEALTH"] then
      local defaults = db:GetOrbDefaults()
      db.char["TARGET_HEALTH"] = defaults["TARGET_HEALTH"]
      rOrbs_DB_CHAR["TARGET_HEALTH"] = db.char["TARGET_HEALTH"]
    end
    -- Ensure TOT_HEALTH exists (backward compat)
    if not db.char["TOT_HEALTH"] then
      local defaults = db:GetOrbDefaults()
      db.char["TOT_HEALTH"] = defaults["TOT_HEALTH"]
      rOrbs_DB_CHAR["TOT_HEALTH"] = db.char["TOT_HEALTH"]
    end
    if db.char.reload then
      db.char.reload = false
    end
    --update the orb view
    SafeUpdateOrbView()

  end

  ---------------------------------------------
  --GLOBAL DATA
  ---------------------------------------------

  --load global data defaults
  db.loadGlobalDataDefaults = function()
    -- silent
    rOrbs_DB_GLOB = db:GetTemplateDefaults()
    rOrbs_DB_GLOB.TEMPLATE_LIST = db:GetTemplateListDefaults()
    db.glob = rOrbs_DB_GLOB
    db.list.template = rOrbs_DB_GLOB.TEMPLATE_LIST
  end

  --load global data
  db.loadGlobalData = function()
    rOrbs_DB_GLOB = rOrbs_DB_GLOB or db:GetTemplateDefaults()
    rOrbs_DB_GLOB.TEMPLATE_LIST = rOrbs_DB_GLOB.TEMPLATE_LIST or db:GetTemplateListDefaults()
    db.glob = rOrbs_DB_GLOB
    db.list.template = rOrbs_DB_GLOB.TEMPLATE_LIST
  end

  ---------------------------------------------
  --TEMPLATES
  ---------------------------------------------

  function db:CopyTable(source, target)
    for key, value in pairs(source) do
      if type(value) == "table" then
        target[key] = {}
        self:CopyTable(value, target[key])
      else
        target[key] = value
      end
    end
  end

  --load template func
  --name: template name
  --type: orb type
  db.loadTemplate = function(name,type)
    if not rOrbs_DB_GLOB or not name then return end
    if not rOrbs_DB_GLOB[name] then
      print(addon..": template |c003399FF"..name.."|r not found")
      return
    end
    db:CopyTable(rOrbs_DB_GLOB[name],rOrbs_DB_CHAR[type])
    print(addon..": template |c003399FF"..name.."|r loaded into "..strlower(type).." orb")
    --update the orb view
    
  end

  --save template func
  --name: template name
  --type: orb type
  db.saveTemplate = function(name,type)
    if not rOrbs_DB_GLOB or not name then return end
    --adding template
    if not rOrbs_DB_GLOB[name] then
      --create default entry first
      local data = db:GetOrbDefaults()
      rOrbs_DB_GLOB[name] = data["HEALTH"]
    end
    db:CopyTable(db.char[type],rOrbs_DB_GLOB[name])
    --adding the template name to the key-value pair list
    local nameFound = false
    for i,v in ipairs(rOrbs_DB_GLOB.TEMPLATE_LIST) do
      if v.key == name then
        nameFound = true
        break
      end
    end
    if not nameFound then
      tinsert(rOrbs_DB_GLOB.TEMPLATE_LIST, { key = name, value = name, notCheckable = true, keepShownOnClick = false, })
    end
    print(addon..": "..strlower(type).." orb data saved as template |c003399FF"..name.."|r")
    --update the panel view
    
  end

  --delete template func
  --name: template name
  db.deleteTemplate = function(name)
    if not rOrbs_DB_GLOB or not name then return end
    if not rOrbs_DB_GLOB[name] then
      print(addon..": template |c003399FF"..name.."|r not found")
      return
    end
    --setting the template to nil
    rOrbs_DB_GLOB[name] = nil
    print(addon..": template |c003399FF"..name.."|r deleted")
    --removing the template name from the key-value pair list
    local indexFound
    for i,v in ipairs(rOrbs_DB_GLOB.TEMPLATE_LIST) do
      if v.key == name then
        indexFound = i
        break
      end
    end
    if indexFound then
      tremove(rOrbs_DB_GLOB.TEMPLATE_LIST, indexFound)
    end
    --update the panel view
    
  end

  ---------------------------------------------
  --PROFILES
  ---------------------------------------------

  --[[ Profile system – correct cross-character approach
       ─────────────────────────────────────────────────
       Profiles are stored fully inside rOrbs_DB_GLOB (account-wide SavedVar),
       so every character on the account can read them.

       Which profile is active for a given character is stored in:
         rOrbs_DB_GLOB.CHAR_PROFILES["Realm-CharName"] = "ProfileName"

       This is the only reliable way because WoW only exposes the CURRENT
       character's SavedVariablesPerCharacter – you cannot read another
       character's rOrbs_DB_CHAR while that character is not logged in.

       On PLAYER_LOGIN (when UnitName("player") is valid) we look up the
       active profile for this character and apply it to rOrbsDB + rOrbs_DB_CHAR.
       This happens in config.lua after ADDON_LOADED.
  ]]

  -- Returns a unique key for the current character: "Realm-Name"
  function db:GetCharKey()
    local name  = UnitName("player") or "Unknown"
    local realm = GetRealmName()     or "Unknown"
    return realm .. "-" .. name
  end

  -- Snapshot the current rOrbsDB settings (everything except positions/scales)
  function db:SnapshotGUI()
    local snap = {}
    if not rOrbsDB then return snap end
    for key, val in pairs(rOrbsDB) do
      if key ~= "framePositions" and key ~= "frameScales" and key ~= "frameLocked" then
        if type(val) ~= "table" then
          snap[key] = val
        else
          snap[key] = {}
          db:CopyTable(val, snap[key])
        end
      end
    end
    return snap
  end

  -- Snapshot the current orb char data (rOrbs_DB_CHAR without internal keys)
  function db:SnapshotChar()
    local snap = {}
    local src  = db.char or db:GetOrbDefaults()
    db:CopyTable(src, snap)
    snap.activeProfile = nil  -- don't store these inside profile data
    return snap
  end

  -- Save current settings as a named profile (stored account-wide in DB_GLOB)
  db.saveProfile = function(name)
    if not name or name == "" then return end
    rOrbs_DB_GLOB.PROFILES     = rOrbs_DB_GLOB.PROFILES     or {}
    rOrbs_DB_GLOB.PROFILE_LIST = rOrbs_DB_GLOB.PROFILE_LIST or {}
    rOrbs_DB_GLOB.CHAR_PROFILES= rOrbs_DB_GLOB.CHAR_PROFILES or {}

    -- Build and store the profile snapshot
    rOrbs_DB_GLOB.PROFILES[name] = {
      char = db:SnapshotChar(),
      gui  = db:SnapshotGUI(),
    }

    -- Register in list if new
    local found = false
    for _, v in ipairs(rOrbs_DB_GLOB.PROFILE_LIST) do
      if v.key == name then found = true; break end
    end
    if not found then
      tinsert(rOrbs_DB_GLOB.PROFILE_LIST, { key = name, value = name, notCheckable = true, keepShownOnClick = false })
    end

    -- Mark this character as using this profile
    rOrbs_DB_GLOB.CHAR_PROFILES[db:GetCharKey()] = name

    -- Also store in rOrbs_DB_CHAR.activeProfile for the label in the GUI
    rOrbs_DB_CHAR.activeProfile = name

    db.list.profile = rOrbs_DB_GLOB.PROFILE_LIST
    print(addon..": Profile |c003399FF"..name.."|r saved.")
  end

  -- Apply a named profile to the current session (rOrbsDB + rOrbs_DB_CHAR)
  -- then ReloadUI so WoW writes the new rOrbs_DB_CHAR to disk for this char.
  db.loadProfile = function(name)
    if not name or name == "" then return end
    rOrbs_DB_GLOB.PROFILES      = rOrbs_DB_GLOB.PROFILES      or {}
    rOrbs_DB_GLOB.CHAR_PROFILES = rOrbs_DB_GLOB.CHAR_PROFILES or {}

    if not rOrbs_DB_GLOB.PROFILES[name] then
      print(addon..": Profile |c003399FF"..name.."|r not found.")
      return
    end
    local prof = rOrbs_DB_GLOB.PROFILES[name]

    -- Apply orb data into rOrbs_DB_CHAR (per-char, written to disk on logout/reload)
    if prof.char then
      -- Wipe existing keys first so removed keys don't persist
      for k in pairs(rOrbs_DB_CHAR) do
        if k ~= "activeProfile" then rOrbs_DB_CHAR[k] = nil end
      end
      db:CopyTable(prof.char, rOrbs_DB_CHAR)
      db.char = rOrbs_DB_CHAR
    end

    -- Apply GUI data into rOrbsDB for THIS session
    if prof.gui then
      for k, v in pairs(prof.gui) do
        rOrbsDB[k] = v
      end
    end

    -- Record which profile this character uses (account-wide, readable next login)
    rOrbs_DB_GLOB.CHAR_PROFILES[db:GetCharKey()] = name
    rOrbs_DB_CHAR.activeProfile = name

    print(addon..": Profile |c003399FF"..name.."|r loaded. Reloading UI…")
    ReloadUI()
  end

  -- Apply the saved profile for the current character (called from config.lua on PLAYER_LOGIN)
  db.applyCharProfile = function()
    if not rOrbs_DB_GLOB then return end
    rOrbs_DB_GLOB.CHAR_PROFILES = rOrbs_DB_GLOB.CHAR_PROFILES or {}
    local charKey = db:GetCharKey()
    local name    = rOrbs_DB_GLOB.CHAR_PROFILES[charKey]
    if not name then return end  -- no profile assigned to this character

    local prof = rOrbs_DB_GLOB.PROFILES and rOrbs_DB_GLOB.PROFILES[name]
    if not prof then return end

    -- Apply gui overrides into rOrbsDB (already loaded at this point)
    -- Only set keys that don't already exist in rOrbsDB to avoid
    -- overwriting user changes made via GUI sliders since the profile was saved.
    if prof.gui then
      for k, v in pairs(prof.gui) do
        if k ~= "framePositions" and k ~= "frameScales" and k ~= "frameLocked" then
          if rOrbsDB[k] == nil then
            rOrbsDB[k] = v
          end
        end
      end
    end

    -- Apply char data into rOrbs_DB_CHAR
    -- Apply char data into rOrbs_DB_CHAR (merge, don't wipe)
    -- Only set missing keys to preserve user changes made since profile was saved.
    if prof.char then
      for k, v in pairs(prof.char) do
        if rOrbs_DB_CHAR[k] == nil then
          if type(v) == "table" then
            rOrbs_DB_CHAR[k] = db:CopyTable(v, {})
          else
            rOrbs_DB_CHAR[k] = v
          end
        end
      end
      db.char = rOrbs_DB_CHAR
    end

    rOrbs_DB_CHAR.activeProfile = name
    if ns.debug then
      print(addon..": Profile |c003399FF"..name.."|r applied for "..charKey)
    end
  end

  -- Delete a named profile
  db.deleteProfile = function(name)
    if not name or name == "" then return end
    if not rOrbs_DB_GLOB.PROFILES or not rOrbs_DB_GLOB.PROFILES[name] then
      print(addon..": Profile |c003399FF"..name.."|r not found.")
      return
    end
    rOrbs_DB_GLOB.PROFILES[name] = nil
    -- Remove from list
    local idx
    for i, v in ipairs(rOrbs_DB_GLOB.PROFILE_LIST or {}) do
      if v.key == name then idx = i; break end
    end
    if idx then tremove(rOrbs_DB_GLOB.PROFILE_LIST, idx) end
    -- Remove any character assignments pointing to this profile
    for charKey, profName in pairs(rOrbs_DB_GLOB.CHAR_PROFILES or {}) do
      if profName == name then
        rOrbs_DB_GLOB.CHAR_PROFILES[charKey] = nil
      end
    end
    db.list.profile = rOrbs_DB_GLOB.PROFILE_LIST or {}
    print(addon..": Profile |c003399FF"..name.."|r deleted.")
  end

  -- Copy (duplicate) a profile under a new name
  db.copyProfile = function(sourceName, destName)
    if not sourceName or not destName then return end
    if not rOrbs_DB_GLOB.PROFILES or not rOrbs_DB_GLOB.PROFILES[sourceName] then
      print(addon..": Source profile |c003399FF"..sourceName.."|r not found.")
      return
    end
    local src  = rOrbs_DB_GLOB.PROFILES[sourceName]
    local dest = {}
    if src.char then dest.char = {}; db:CopyTable(src.char, dest.char) end
    if src.gui  then dest.gui  = {}; db:CopyTable(src.gui,  dest.gui)  end
    rOrbs_DB_GLOB.PROFILES[destName] = dest
    local found = false
    for _, v in ipairs(rOrbs_DB_GLOB.PROFILE_LIST or {}) do
      if v.key == destName then found = true; break end
    end
    if not found then
      tinsert(rOrbs_DB_GLOB.PROFILE_LIST, { key = destName, value = destName, notCheckable = true, keepShownOnClick = false })
    end
    db.list.profile = rOrbs_DB_GLOB.PROFILE_LIST
    print(addon..": Profile |c003399FF"..sourceName.."|r copied to |c003399FF"..destName.."|r.")
  end

  -- Initialize / refresh profile list after glob data is loaded
  local _origLoadGlobalData = db.loadGlobalData
  db.loadGlobalData = function()
    _origLoadGlobalData()
    rOrbs_DB_GLOB.PROFILES      = rOrbs_DB_GLOB.PROFILES      or {}
    rOrbs_DB_GLOB.PROFILE_LIST  = rOrbs_DB_GLOB.PROFILE_LIST  or {}
    rOrbs_DB_GLOB.CHAR_PROFILES = rOrbs_DB_GLOB.CHAR_PROFILES or {}
    db.list.profile = rOrbs_DB_GLOB.PROFILE_LIST
  end

  db.list.profile = {}
  db.getListProfile = function() return db.list.profile end

  ---------------------------------------------
  --LIST / MODELS
  ---------------------------------------------

  --mode list for dropdown
  db.list.model = {
    {
      key = "orbtacular",
      value = "orbtacular",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 48109, key = "purble flash orb", },
        { value = 48106, key = "blue flash orb", },
        { value = 32368, key = "pearl", },
        { value = 44652, key = "the planet", },
        { value = 47882, key = "red chocolate", },
        { value = 48254, key = "purple chocolate", },
        { value = 33853, key = "red magnet", },
        { value = 34404, key = "white magnet", },
        { value = 38699, key = "dwarf artifact", },
        { value = 20782, key = "water planet", },
        { value = 25392, key = "sahara", },
        { value = 37867, key = "cthun", },
        { value = 39108, key = "purple circus", },
        { value = 16111, key = "spore", },
        { value = 22707, key = "snow ball", },
        { value = 29308, key = "death ball", },
        { value = 25889, key = "sphere", },
        { value = 28741, key = "titan orb", },
        { value = 42486, key = "force sphere", },
        { value = 45414, key = "soulshard", },
        { value = 55036, key = "arcane orb", },
        { value = 55948, key = "purple orb", },
        { value = 56632, key = "brown chocolate", },
        { value = 60225, key = "rage orb", },
      },
    },
    {
      key = "fog",
      value = "fog",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 17010, key = "red fog", },
        { value = 17054, key = "purple fog", },
        { value = 17055, key = "green fog", },
        { value = 17286, key = "yellow fog", },
        { value = 18075, key = "turquoise fog", },
        { value = 23343, key = "white fog", },
        { value = 58827, key = "orb fog", },
      },
    },
    {
      key = "portal",
      value = "portal",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 23422, key = "red portal", },
        { value = 34319, key = "blue portal", },
        { value = 34645, key = "purple portal", },
        { value = 29074, key = "warlock portal", },
        { value = 40645, key = "soul harvest", },
        { value = 52396, key = "yellow portal", },
        { value = 58948, key = "blue portal 2", },
      },
    },
    {
      key = "swirly",
      value = "swirly",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 27393, key = "blue rune swirly", },
        { value = 28460, key = "purple swirly", },
        { value = 29561, key = "blue swirly", },
        { value = 29286, key = "white swirly", },
        { value = 39581, key = "magic swirly", },
        { value = 23310, key = "swirly cloud", },
        { value = 55752, key = "white cloud", },
      },
    },
    {
      key = "fire",
      value = "fire",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 27625, key = "green fire", },
        { value = 38327, key = "fire", },
        { value = 28639, key = "green vapor", },
        { value = 53026, key = "skull", },
      },
    },
    {
      key = "elemental",
      value = "elemental",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 17065, key = "purple naaru", },
        { value = 17871, key = "white naaru", },
        { value = 1070,  key = "fire elemental", },
        { value = 14252, key = "purple elemental", },
        { value = 19003, key = "white elemental", },
        { value = 15406, key = "light-green elemental", },
        { value = 17045, key = "red elemental", },
        { value = 9449,  key = "green elemental", },
        { value = 4629,  key = "shadow elemental", },
        { value = 22731, key = "glow elemental", },
        { value = 16635, key = "void walker", },
        { value = 16170, key = "green ghost", },
        { value = 24905, key = "fire guard", },
        { value = 31450, key = "flaming bone guard", },
        { value = 34942, key = "bound fire elemental", },
        { value = 36345, key = "bound water elemental", },
        { value = 53456, key = "wod fire elemental", },
        { value = 58534, key = "magma elemental", },
      },
    },
    {
      key = "crystal",
      value = "crystal",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 17856, key = "blue crystal", },
        { value = 20900, key = "green crystal", },
        { value = 22506, key = "purple crystal", },
        { value = 26419, key = "health crystal", },
        { value = 26418, key = "power crystal", },
      },
    },
    {
      key = "aquarium",
      value = "aquarium",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 4878,  key = "fish", },
        { value = 7449,  key = "deviat", },
      },
    },
    {
      key = "unique",
      value = "unique",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 10992, key = "diablo", },
        { value = 38803, key = "murcablo", },
        { value = 5233,  key = "blue angel", },
        { value = 6888,  key = "alarm-o-bot", },
        { value = 11986, key = "molten giant", },
        { value = 38594, key = "magma giant", },
        { value = 28641, key = "algalon", },
        { value = 31094, key = "spectral bear", },
        { value = 28890, key = "mimiron head", },
        { value = 32913, key = "therazane", },
        { value = 38150, key = "fire kitten", },
        { value = 38187, key = "orange fire helldog", },
        { value = 38189, key = "blue fire helldog", },
        { value = 39354, key = "deathwing lava claw", },
        { value = 40924, key = "cranegod", },
        { value = 38548, key = "burning blob", },
        { value = 1824,  key = "blue wisp", },
        { value = 49084,  key = "robot", },
      },
    },
    {
      key = "sparkling",
      value = "sparkling",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 26753, key = "spark", },
        { value = 27617, key = "yellow spark", },
        { value = 51486, key = "creme spark", },
        { value = 46920, key = "purple splash", },
        { value = 48210, key = "yellow plasma", },
        { value = 29612, key = "strobo", },
        { value = 41110, key = "strobo2", },
        { value = 44465, key = "strobo3", },
        { value = 30792, key = "hammer of wrath", },
        { value = 47891, key = "aqua spark", },
        { value = 57891, key = "orb spark", },
        { value = 60361, key = "yellow orb spark", },
      },
    },
    {
      key = "spirit",
      value = "spirit",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 2421,  key = "killrock eye", },
        { value = 46174, key = "darkmoon eye", },
        { value = 21485, key = "blue soul", },
        { value = 30150, key = "red soul", },
        { value = 39740, key = "red spirit", },
        { value = 39738, key = "blue spirit", },
        { value = 28089, key = "ghost skull", },
        { value = 51370, key = "red snake spirit", },
      },
    },
    {
      key = "environment",
      value = "environment",
      hasArrow = true,
      notCheckable = true,
      menuList = {
        { value = 35741, key = "fire flower", },
        { value = 36405, key = "oasis flower", },
        { value = 42785, key = "icethorn flower", },
        { value = 39014, key = "purple mushroom", },
        { value = 36901, key = "purple lantern", },
        { value = 36902, key = "turquoise lantern", },
        { value = 31905, key = "purple egg", },
        { value = 34010, key = "orange egg", },
        { value = 26506, key = "bubble torch", },
        { value = 41853, key = "onyx statue", },
        { value = 51406, key = "melting pot", },
        { value = 53769, key = "white flower", },
      },
    },
  }
  db.getListModel = function() return db.list.model end

  ---------------------------------------------
  --LIST / FILLING TEXTURES
  ---------------------------------------------

  --filling texture list for dropdown
  db.list.filling_texture = {
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling1",  key = "moon", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling2",  key = "earth", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling3",  key = "mars", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling4",  key = "galaxy", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling5",  key = "jupiter", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling6",  key = "fraktal circle", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling7",  key = "sun", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling8",  key = "icecream", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling9",  key = "marble", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling10", key = "gradient", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling11", key = "bubbles", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling12", key = "woodpepples", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling13", key = "golf", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling14", key = "darkstar", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling15", key = "diablo3", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling16", key = "fubble", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling17", key = "silver", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling18", key = "exile", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling19", key = "dominion", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling20", key = "runes", },
    { value = "Interface\\AddOns\\rOrbs\\media\\orb_filling21", key = "sigil orb", },
	{ value = "Interface\\AddOns\\rOrbs\\media\\orb_transparent", key = "transparent", },
  }
  db.getListFillingTexture = function() return db.list.filling_texture end

  ---------------------------------------------
  --LIST / TEMPLATEs
  ---------------------------------------------

  db.list.template = {} --reference for later
  db.getListTemplate = function() return db.list.template end

  ---------------------------------------------
  --LIST / HEALTH TAGs
  ---------------------------------------------

  --health tag list for dropdown
  db.list.tag = {
    { value = "topdef", key = "Top default", },
    { value = "botdef", key = "Bottom default", },
    { value = "per",    key = "Percentage", },
    { value = "perp",   key = "Percentage + %", },
    { value = "cur",    key = "Current value", },
    { value = "curs",   key = "Current value short", },
    { value = "max",    key = "Maximum value", },
    { value = "maxs",   key = "Maximum value short", },
    { value = "cmax",   key = "Current/Maximum value", },
    { value = "cmaxs",  key = "Current/Maximum value short", },
    { value = "null",   key = "Nothing", },
  }
  db.getListTag = function() return db.list.tag end
