DBMFu = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDB-2.0", "FuBarPlugin-2.0");
local L = AceLibrary("AceLocale-2.2"):new("DBMFu");
local Tablet = AceLibrary("Tablet-2.0");

L:RegisterTranslations("enGB", function() return {
	["tabletHint"] = "Click to toggle DBM.",
	["labelName"] = "DBM",
} end);

DBMFu:RegisterDB("DBMFuDB");
DBMFu.hasIcon = true;
DBMFu.defaultPosition = "RIGHT";

local optionsTable = {
	handler = DBMFu,
	type = "group",
	args = {};
};

DBMFu:RegisterChatCommand({ "/dbmfu" }, optionsTable);
DBMFu.OnMenuRequest = optionsTable;

function DBMFu:OnTextUpdate()
	if (self:IsTextShown()) then
		self:ShowText();
		self:SetText("|cffffffff"..L["labelName"].."|r");
	else
		self:HideText();
	end
end

function DBMFu:OnTooltipUpdate()
	Tablet:SetHint(L["tabletHint"]);
end

function DBMFu:OnClick()
	DBMMinimapButton:GetScript("OnClick")();
end
