local ADDON_NAME, ns = ...
local WF = ns.WF

WF.UI = WF.UI or {}
WF.UI.HelpPages = WF.UI.HelpPages or {}
WF.UI.HelpPages.OverviewSections = WF.UI.HelpPages.OverviewSections or {}

local Sections = WF.UI.HelpPages.OverviewSections

function Sections.BuildToken(ctx, env)
  local Widgets = env.Widgets
  local C4 = env.C4
  local TEXT = env.TEXT
  local rSC = env.rSC
  local tDiv = env.tDiv
  local MakeSectionTitle = env.MakeSectionTitle
  local MakeBodyText = env.MakeBodyText
  local MakeMutedText = env.MakeMutedText
  local MakeDivider = env.MakeDivider

    -- WoW Token
    local tokTitle = MakeSectionTitle(rSC, "WoW Token")
    tokTitle:SetPoint("TOPLEFT", tDiv, "BOTTOMLEFT", 0, -18)

    local tokPrice = MakeBodyText(rSC, "Price: —")
    tokPrice:SetPoint("TOPLEFT", tokTitle, "BOTTOMLEFT", 0, -10)
    tokPrice:SetJustifyH("LEFT")
    tokPrice:SetTextColor(C4(TEXT, TEXT))

    local tokUpdated = MakeMutedText(rSC, "Updated: —")
    tokUpdated:SetPoint("TOPLEFT", tokPrice, "BOTTOMLEFT", 0, -4)
    tokUpdated:SetJustifyH("LEFT")

    local tokGoal = MakeBodyText(rSC, "Per Day Goal: —")
    tokGoal:SetPoint("TOPLEFT", tokUpdated, "BOTTOMLEFT", 0, -8)
    tokGoal:SetJustifyH("LEFT")
    tokGoal:SetTextColor(C4(TEXT, TEXT))

    local tokRemain = MakeBodyText(rSC, "Remaining: —")
    tokRemain:SetPoint("TOPLEFT", tokGoal, "BOTTOMLEFT", 0, -4)
    tokRemain:SetJustifyH("LEFT")
    tokRemain:SetTextColor(C4(TEXT, TEXT))

    local bTok = Widgets:Button(rSC, "Refresh Token", 160, 26)
    bTok:SetPoint("TOPLEFT", tokRemain, "BOTTOMLEFT", 0, -8)

    local tokDiv = MakeDivider(rSC)
    tokDiv:SetPoint("LEFT", rSC, "LEFT", 12, 0)
    tokDiv:SetPoint("RIGHT", rSC, "RIGHT", -12, 0)
    tokDiv:SetPoint("TOP", bTok, "BOTTOM", 0, -14)



    return {
      tokPrice = tokPrice,
      tokUpdated = tokUpdated,
      tokGoal = tokGoal,
      tokRemain = tokRemain,
      bTok = bTok,
      tokDiv = tokDiv,
    }
end
