local addon, ns = ...
local ss = ns.SS

local setmetatable = setmetatable
local CreateFrame = CreateFrame

local mtContainer = {};

function mtContainer:New(parent, config, displayMode)
  local sphere  = CreateFrame("Frame","SeamoreSpheres_"..config.."container",parent)
  sphere:SetScale(1)
  sphere:SetHeight(ss.global.general["SphereSize"] / ss.db[config].general.scale)
  sphere:SetWidth(ss.global.general["SphereSize"] / ss.db[config].general.scale)
  sphere:SetAllPoints(parent)

  if displayMode == "active" then
    sphere:SetFrameStrata("MEDIUM")
  else
    sphere:SetFrameStrata("HIGH")
    sphere.displayMode = "preview"
  end

  return sphere
end

function mtContainer:NewGroupItem(parent, config, index)
  local sphere  = CreateFrame("Frame","SeamoreSpheres_"..config.."_microsphere"..index.."_container",parent)
  sphere:SetScale(1)
  sphere:SetHeight(30 / ss.db[config].general.scale)
  sphere:SetWidth(30 / ss.db[config].general.scale)
  sphere:SetAllPoints(parent)

  if self.displayMode == "active" then
    sphere:SetFrameStrata("MEDIUM")
  else
    sphere:SetFrameStrata("HIGH")
    sphere.displayMode = "preview"
  end

  return sphere
end

ss["ContainerCreator"] = setmetatable({}, { __index = mtContainer });
