local C = Broker_Everything.color

local calendar_init = function ()
	GameTimeFrame:Hide()
	GameTimeFrame.Show = dummyFunc
end


local calendar_onevent = function(self)
	if CalendarGetNumPendingInvites() > 0 then
		self.obj.text = C.dkgreen(L["Pending Invites"])
	else
		self.obj.text = L["No Invites"]
	end
end


local calendar_events = {
	"CALENDAR_UPDATE_PENDING_INVITES",
	"PLAYER_LOGIN",
	"PLAYER_ENTERING_WORLD"
}


local calendar_tooltip = function(t)
	local x = CalendarGetNumPendingInvites()
	t:AddLine(L["Calendar"])
	t:AddLine(" ")
	if x == 0 then
		t:AddLine(C.white(L["No pending invites"]))
	else
		t:AddLine(C.white(string.format("%d %s.", x, L["invites"])))
	end
	t:AddLine(" ")
	t:AddLine(C.dkgreen(L["CALLEFTHINT"]))
end


Broker_Everything:Register("Calendar",
	--GetItemIcon(7516),
	"Interface\\Addons\\Broker_Everything\\media\\calendar",
	calendar_init,
	calendar_onevent,
	calendar_events,
	ToggleCalendar,
	calendar_tooltip,
	nil,
	nil)
