LeoAltholic_Settings = ZO_Object:Subclass()
local LAM = LibStub("LibAddonMenu-2.0")

function LeoAltholic_Settings:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end

function LeoAltholic_Settings:Initialize()
end

function LeoAltholic_Settings:CreatePanel()
	local OptionsName = "LeoAltholicOptions"
	local panelData = {
		type = "panel",
		name = LeoAltholic.name,
        slashCommand = "/leoaltoptions",
		displayName = "|c39B027"..LeoAltholic.displayName.."|r",
		author = "@LeandroSilva",
		version = LeoAltholic.version,
		registerForRefresh = false,
		registerForDefaults = true,
		website = "http://www.esoui.com/downloads/info2140-LeosAltholic.html"
	}
	LAM:RegisterAddonPanel(OptionsName, panelData)

	local optionsData = {
		{
			type = "header",
			name = "|c3f7fff"..GetString(LEOALT_TRACKED_QUESTS).."|r"
		},{
			type = "checkbox",
			name = GetString(LEOALT_AUTO_TRACK_WRIT),
			default = false,
			getFunc = function() return LeoAltholic.savedVariables.settings.tracked.dailyWrits end,
			setFunc = function(value)
				LeoAltholic.savedVariables.settings.tracked.dailyWrits = value
			end,
		},{
			type = "checkbox",
			name = GetString(LEOALT_AUTO_TRACK_DAILY),
			default = false,
			getFunc = function() return LeoAltholic.savedVariables.settings.tracked.allDaily end,
			setFunc = function(value)
				LeoAltholic.savedVariables.settings.tracked.allDaily = value
			end,
		},{
			type = "header",
			name = "|c3f7fff"..GetString(LEOALT_COMPLETED_RESEARCH).."|r"
		},{
			type = "checkbox",
			name = GetString(LEOALT_CHAT_ALL),
			tooltip = GetString(LEOALT_CHAT_ALL_TOOLTIP),
			default = true,
			getFunc = function() return LeoAltholic.savedVariables.settings.completedResearch.chat end,
			setFunc = function(value)
				LeoAltholic.savedVariables.settings.completedResearch.chat = value
			end,
		},{
			type = "checkbox",
			name = GetString(LEOALT_CENTERSCREEN_CURRENT),
			tooltip = GetString(LEOALT_CENTERSCREEN_CURRENT_TOOLTIP),
			default = true,
			getFunc = function() return LeoAltholic.savedVariables.settings.completedResearch.screen end,
			setFunc = function(value)
				LeoAltholic.savedVariables.settings.completedResearch.screen = value
			end,
		}
	}
	LAM:RegisterOptionControls(OptionsName, optionsData)
end

function LeoAltholic_Settings_OnMouseEnter(control, tooltip)
	InitializeTooltip(InformationTooltip, control, BOTTOMLEFT, 0, -2, TOPLEFT)
	SetTooltipText(InformationTooltip, tooltip)
end