--[[
============================================================
Decor Vendor Addon
© 2026 MidniteDestiny. All Rights Reserved.
============================================================

This file is part of the Decor Vendor addon.

All code, structure, and design are the intellectual
property of MidniteDestiny unless otherwise stated.

You may NOT:
• Copy, reproduce, or redistribute this code
• Modify and redistribute this code
• Use this code in other addons or projects

without explicit permission from the author.

This addon is distributed for personal use only.

============================================================
]]

local addonName, dv = ...

local frame = dv.frame

if not frame then
    print("|cffff4040DecorVendor Commands:|r dv.frame is missing. Make sure UI\\MainFrame.lua loads first.")
    return
end

-------------------------------------------------
-- Slash Commands
-------------------------------------------------

SLASH_DECORVENDOR1 = "/decor"
SLASH_DECORVENDOR2 = "/dv"
SLASH_DECORVENDOR3 = "/decorvendor"

SlashCmdList["DECORVENDOR"] = function()
    if frame and frame:IsShown() then
        frame:Hide()
    else
        if dv.OpenMainUI then
            dv.OpenMainUI()
        end
    end
end

-------------------------------------------------
-- Addon Compartment
-------------------------------------------------

function DecorVendor_OnAddonCompartmentClick(addonName, button)
    if button == "LeftButton" then
        if frame:IsShown() then
            frame:Hide()
        else
            frame:Show()
        end

    elseif button == "RightButton" then
        if Settings and dv.optionsCategory then
            Settings.OpenToCategory(dv.optionsCategory:GetID())
        end
    end
end

function DecorVendor_OnAddonCompartmentEnter(addonName, button)
    GameTooltip:SetOwner(button, "ANCHOR_LEFT")
    GameTooltip:SetText("Decor Vendor", 1, 0.82, 0)
    GameTooltip:AddLine("Left-click: Open Decor Vendor", 1, 1, 1)
    GameTooltip:AddLine("Right-click: Open Settings", 1, 1, 1)
    GameTooltip:Show()
end

function DecorVendor_OnAddonCompartmentLeave(addonName, button)
    GameTooltip:Hide()
end