--[[
============================================================================
Enhanced Toy Tracker  -  EToy/Core/Commands.lua
============================================================================
Slash command to open the toy browser. /etoy or /ett.
============================================================================
]]--

local ADDON_NAME, NS = ...
local ETT = NS.ETT

SLASH_EToy1 = "/etoy"
SLASH_EToy2 = "/ett"
SlashCmdList["EToy"] = function(msg)
    msg = (msg or ""):lower():gsub("^%s+", ""):gsub("%s+$", "")
    if msg == "count" then
        local owned, total = ETT:Counts()
        ETT:Printf("%d / %d toys collected.", owned, total)
        return
    end
    if ETT.Browser and ETT.Browser.Toggle then
        ETT.Browser:Toggle()
    else
        ETT:Error("Toy browser is not ready yet.")
    end
end
