local addonName, addonTable = ...

local ScritchPop = CreateFrame("Frame")
ScritchPop:RegisterEvent("ADDON_LOADED")
ScritchPop:RegisterEvent("PLAYER_ENTERING_WORLD")
ScritchPop:RegisterEvent("PLAYER_LOGIN")
ScritchPop:SetScript("OnEvent", function(_, event, arg1)
    if (event == "ADDON_LOADED" or event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_LOGIN") and arg1 == addonName then
        ScritchPopConfig = ScritchPopConfig or {}

        for k, v in pairs(addonTable.default) do
            if ScritchPopConfig[k] == nil then
                ScritchPopConfig[k] = v
            end
        end  

        local frame = CreateFromMixins(addonTable.ComboPointsMixin)
        frame:Init()    
        addonTable.cp_frame = frame

        addonTable.InitOptions()
    end
end)