local _, core = ...; -- Namespace
local AceGUI = LibStub("AceGUI-3.0")
local WidgetType = core.WidgetType


function core.Dashboard(container, sections)

 --[[ Scroll Frame ]]--
  local scrollcontainer = AceGUI:Create("SimpleGroup")
  scrollcontainer:SetFullWidth(true)
  scrollcontainer:SetFullHeight(true)
  scrollcontainer:SetLayout("Fill")

  container:AddChild(scrollcontainer)

  local scroll = AceGUI:Create("ScrollFrame")
  scroll:SetLayout("Flow")
  scrollcontainer:AddChild(scroll)

  for _, section in ipairs(sections or core.Guides["NotFound"]) do
  
    local Widget = AceGUI:Create("Label")
    Widget:SetText(section.Value)
	Widget:SetFullWidth(true)
	
		if section.Type == core.WidgetType.Text then --[[Create Default Text]]
			Widget:SetColor(255, 255, 255)
			Widget:SetFont("Fonts\\FRIZQT__.TTF", 11, '')
			
		elseif section.Type == core.WidgetType.Title then --[[Create Title]]
			Widget:SetColor(0, 255, 255)
			Widget:SetFont("Fonts\\FRIZQT__.TTF", 14, '')
			
		elseif section.Type == core.WidgetType.Selection then --[[Create Guide Selection Button]]
			Widget = AceGUI:Create("Button")
			Widget:SetText(section.Value)
			Widget:SetWidth(400)
			Widget:SetCallback("OnClick", function()  container:ReleaseChildren()  core.Dashboard(container, core.Guides[section.Guide]) end)
			
		elseif section.Type == core.WidgetType.Waypoint then --[[Create Waypoint Button]]
			Widget = AceGUI:Create("Button")
			Widget:SetText(section.Value)
			Widget:SetWidth(400)
			Widget:SetHeight(25)
			Widget:SetCallback("OnClick", function()  DEFAULT_CHAT_FRAME.editBox:SetText("/way ".."#"..section.Zone.." "..section.Way) ChatEdit_SendText(DEFAULT_CHAT_FRAME.editBox, 0) end)
			

		elseif section.Type == core.WidgetType.IconTitle then --[[Create Icon Title]]
			Widget:SetFullWidth(true)
			Widget:SetFont("Fonts\\FRIZQT__.TTF", 20, '')
			Widget:SetText(section.Icon.." ".."|cff00C78C"..section.Value)
		
		elseif section.Type == core.WidgetType.ItemLink then --[[Create InteractiveLabel]]
			Widget = AceGUI:Create("InteractiveLabel")
			Widget:SetText(section.Value)

		elseif section.Type == core.WidgetType.ListBox then --[[Create Dropdown Menu]]
			Widget = AceGUI:Create("Dropdown")
			Widget:SetWidth(400)
			Widget:SetText(section.Value)
			Widget:SetList(section.List)

		elseif section.Type == core.WidgetType.EditBox then --[[Create EditBox]]
			Widget = AceGUI:Create("EditBox")
			Widget:SetText(section.Value)

		elseif section.Type == core.WidgetType.Icon then --[[Create EditBox]]
			Widget = AceGUI:Create("Icon")
			Widget:SetImage(section.Value)
			Widget:SetFullWidth(true)
			Widget:SetImageSize(350, 350)
			
			
		end
    scroll:AddChild(Widget)
  end

end



return core




