local Module = SUI:NewModule("Skins.ActionHouse");

function Module:OnEnable()
    if (SUI:Color()) then
        local f = CreateFrame("Frame")
        f:RegisterEvent("ADDON_LOADED")
        f:SetScript("OnEvent", function(self, event, name)
            if name == "Blizzard_AuctionUI" then
                SUI:Skin(AuctionFrame)
                SUI:Skin(AuctionFrameTab1)
                SUI:Skin(AuctionFrameTab2)
                SUI:Skin(AuctionFrameTab3)
                SUI:Skin(BrowseBuyoutButton)
                SUI:Skin(BrowseCloseButton)
                SUI:Skin(BrowseBidButton)
                SUI:Skin(BidBidButton)
                SUI:Skin(BidBuyoutButton)
                SUI:Skin(BidCloseButton)
                SUI:Skin(AuctionsCancelAuctionButton)
                SUI:Skin(AuctionsCloseButton)
                SUI:Skin(AuctionsCreateAuctionButton)
                SUI:Skin(BrowseSearchButton)
                SUI:Skin(BrowseResetButton)
                SUI:Skin(AuctionFilterButton1)
                SUI:Skin(AuctionFilterButton2)
                SUI:Skin(AuctionFilterButton3)
                SUI:Skin(AuctionFilterButton4)
                SUI:Skin(AuctionFilterButton5)
                SUI:Skin(AuctionFilterButton6)
                SUI:Skin(AuctionFilterButton7)
                SUI:Skin(AuctionFilterButton8)
                SUI:Skin(AuctionFilterButton9)
                SUI:Skin(AuctionFilterButton10)
                SUI:Skin(AuctionFilterButton11)
                SUI:Skin(AuctionFilterButton12)
                SUI:Skin(AuctionFilterButton13)
                SUI:Skin(AuctionFilterButton14)
                SUI:Skin(AuctionFilterButton15)
                SUI:Skin(BrowseFilterScrollFrame)

                if not (IsAddOnLoaded("Auctionator")) then return end
                local function updateAuctionTabs()
                    SUI:Skin(AuctionatorShoppingFrame)
                    SUI:Skin(AuctionatorShoppingFrame.NewListButton)
                    SUI:Skin(AuctionatorShoppingFrame.ImportButton)
                    SUI:Skin(AuctionatorShoppingFrame.ExportButton)
                    SUI:Skin(AuctionatorShoppingFrame.ExportCSV)
                    SUI:Skin(AuctionatorShoppingFrame.SearchOptions.SearchButton)
                    SUI:Skin(AuctionatorShoppingFrame.SearchOptions.MoreButton)
                    SUI:Skin(AuctionatorShoppingFrame.SearchOptions.AddToListButton)
                    SUI:Skin(AuctionatorShoppingFrame.SearchOptions)
                    SUI:Skin(AuctionatorShoppingFrame.ContainerTabs.ListsTab)
                    SUI:Skin(AuctionatorShoppingFrame.ContainerTabs.RecentsTab)
                    SUI:Skin(AuctionatorShoppingFrame.ListsContainer.Inset)
                    SUI:Skin(AuctionatorShoppingFrame.ShoppingResultsInset)
                    SUI:Skin(AuctionatorShoppingFrame.ResultsListing.HeaderContainer)
                    SUI:Skin(AuctionatorSellingFrame.BuyFrame.CurrentPrices.Inset)
                    SUI:Skin(AuctionatorSellingFrame.BuyFrame.HistoryButton)
                    SUI:Skin(AuctionatorSellingFrame.BuyFrame.CurrentPrices.RefreshButton)
                    SUI:Skin(AuctionatorSellingFrame.BuyFrame.CurrentPrices.BuyButton)
                    SUI:Skin(AuctionatorSellingFrame.BuyFrame.CurrentPrices.CancelButton)
                    SUI:Skin(AuctionatorPostButton)
                    SUI:Skin(AuctionatorSellingFrame.BagInset)
                    SUI:Skin(AuctionatorCancellingFrame.HistoricalPriceInset)
                    SUI:Skin(AuctionatorCancelUndercutButton)
                    SUI:Skin(AuctionatorConfigFrame.OptionsButton)
                    SUI:Skin(AuctionatorConfigFrame.ScanButton)
                    SUI:Skin(AuctionatorConfigFrame)
                    SUI:Skin(AuctionFrameTab4)
                    SUI:Skin(AuctionFrameTab5)
                    SUI:Skin(AuctionFrameTab6)
                    SUI:Skin(AuctionFrameTab7)
                end
                C_Timer.After(0.1, updateAuctionTabs)
            end
        end)
    end
end
