local addonName, SinsToolkit = ...

SinsToolkit.UI = SinsToolkit.UI or {}
SinsToolkit.UI.Pages = SinsToolkit.UI.Pages or {}

local PageBase = SinsToolkit.UI.Pages.Base or {}
local Helpers = SinsToolkit.UI.Pages.Helpers or {}
local Page = {}
setmetatable(Page, { __index = PageBase })
SinsToolkit.UI.Pages.Automation = Page
Page.density = Helpers.GetDefaultDensity and Helpers.GetDefaultDensity() or "compact"

function Page:Create(CreateScrollablePage, Window, CreateWrappedText)
    local getGV = Helpers.GetGV
    local setGV = Helpers.SetGV

    local automationPage = Helpers.CreateContentPage(Window, "Automation")
    local autoHeader = Window:CreateSectionHeader(automationPage, "Automation")
    CreateWrappedText(automationPage, {"TOPLEFT", autoHeader, "BOTTOMLEFT", 0, -8}, 720, "Optional helpers for repeated interaction and Druid form handling. Auto Unshift and Auto Flight Form are separate Druid options, so you can use one without enabling the other.", "GameFontHighlightSmall")
    local cbAutoGossip = Window:CreateCheckbox(automationPage, "Automate Gossip", getGV("automateGossip"), setGV("automateGossip"), "Automatically selects safe single-option gossip while avoiding city direction, trainer, bank, auction house, and storyteller-style gossip.")
    cbAutoGossip:SetPoint("TOPLEFT", autoHeader, "BOTTOMLEFT", 0, -48)
    local btnGossipMod = Helpers.CreateOptionGroup(Window, automationPage, "Gossip Bypass Modifier", Helpers.MODIFIER_OPTIONS, getGV("automateGossipModifier"), setGV("automateGossipModifier"), "Hold this modifier key to temporarily bypass auto-gossip. None means auto-gossip has no modifier bypass.")
    btnGossipMod:SetPoint("TOPLEFT", cbAutoGossip, "BOTTOMLEFT", 4, -16)
    local cbAutoUnshift = Window:CreateCheckbox(automationPage, "Auto Unshift for Druids", getGV("gseAutoUnshift"), setGV("gseAutoUnshift"), Helpers.AUTO_UNSHIFT_TOOLTIP)
    cbAutoUnshift:SetPoint("TOPLEFT", btnGossipMod, "BOTTOMLEFT", -4, -16)
    local cbFlight = Window:CreateCheckbox(automationPage, "Druid Auto Flight Form", getGV("druidAutoFlightForm"), setGV("druidAutoFlightForm"), "When you are a Druid in ground Travel Form and move into an outdoor flyable area, Sin's Toolkit helps move you toward Flight Form on your next safe travel-form action. It never runs in combat, instances, challenge modes, while flying, or while submerged.")
    cbFlight:SetPoint("TOPLEFT", cbAutoUnshift, "BOTTOMLEFT", 0, -8)

    self.frame = automationPage
    return automationPage
end

Page:Register("Automation")

return Page