local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
local events = child['events']
local zzLDB = LibStub:GetLibrary("zzLDB")
local folder = addonName ~= childName  and format("Interface\\AddOns\\%s\\%s", addonName, childName) or format("Interface\\AddOns\\%s", childName)
local function OnClick(self, button)
	zzLDB:DefaultOnClick(self, button, addon, childName)
end
local function OnTooltipShow(tip)
	tip:AddLine(childName)
	for _,v in ipairs({GetLatestThreeSenders()}) do
		tip:AddLine(child:colorize(v,"ffffff"))
	end
	events.MAIL_SHOW(child, 'FIRE')
end
child['ldb'] =  { -- https://github.com/tekkub/libdatabroker-1-1/wiki/Data-Specifications
	['type'] = 'data source', -- required: 'data source' or 'launcher'
	['text'] = childName, -- required/optional for launcher
	['icon'] = format("%s\\icon2.tga", folder), -- optional/required for launcher
	['OnClick'] = OnClick, -- optional/required for launcher
	['OnTooltipShow'] = OnTooltipShow, -- optional
}
local init = {
	Setup = function(self, childName, event)
		child.OnText = zzLDB.DefaultOnText
	end
}
addon.RegisterCallback(init, format("Init%s", childName), 'Setup', childName)