local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
function child:PrefChanged(...)
	child['update']()
end
local init = {
	Setup = function(self)
		local db = child['db']
		local config = LibStub:GetLibrary("zzConfig")
		local options = child['options']
		local main = options['args'][childName]
		local menu = config:AddConfigMenu(options, L['Bagtypes'], 2, config:GetDefaultHandler(child['events']['BAG_UPDATE_DELAYED'], db['bagTypes']))
		config:AddConfigEntry(main, "showFree", "toggle", L['Show free space'],L['Show free space instead of used space'], 1)
		child.PrefChanged = child['events']['BAG_UPDATE_DELAYED']
		for k, v in pairs(child['bagStatus']['bagTypes']) do
			config:AddConfigEntry(menu, v, "toggle", v)
		end
	end
}
addon.RegisterCallback(init, format("Init%s", childName), 'Setup')