--Lua functions
local AddOnName, nsVars = ...
local ss = nsVars.SS

--slash command method
local function CommandFunc(msg)
  local cmd, rest = msg:match("^(%S*)%s*(.-)$");
  local restdouble2
rest, restdouble2 = rest:match("^(%S*)%s*(.-)$");

  if cmd == "nuke" then
    ss:ResetSpheres()
  elseif cmd == "r" then
    ReloadUI()
  elseif cmd == "debug" then
    if rest == "cursor" then
      ss.Debug.describe({GetCursorPosition()})
    elseif rest == "spell" then
      ss.Debug.describe({GetSpellCharges(restdouble2)})
    elseif rest == "spellinfo" then
      ss.Debug.describe({GetSpellInfo(restdouble2)})
    elseif rest == "spellcd" then
      ss.Debug.describe({GetSpellCooldown(restdouble2)})
    elseif rest == "spellcount" then
      ss.Debug.describe({GetSpellCount(restdouble2)})
    elseif rest == "buffinfo" then
      ss.Debug.describe({UnitBuff("player", restdouble2)})
    elseif rest == "petbuffinfo" then
      ss.Debug.describe({UnitBuff("pet", restdouble2), GetPetTimeRemaining()})
    elseif rest == "isplayerspell" then
      ss.Debug.describe({IsPlayerSpell(restdouble2)})
    elseif rest == "talentinfo" then
      ss.Debug.describe({GetTalentInfo(5,1,1)})
    end
  else
    ss:ToggleConfig()
  end
end

--setup the slash command stuff, hide the GUI
SlashCmdList["SS"] = CommandFunc;
SLASH_SS1 = "/ss";
