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.Identifier = 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 identifierPage = Helpers.CreateContentPage(Window, "Identifier")
    local idHeader = Window:CreateSectionHeader(identifierPage, "Identifier")
    CreateWrappedText(identifierPage, {"TOPLEFT", idHeader, "BOTTOMLEFT", 0, -8}, 720, "Inspect frames under your cursor, copy frame details, and look up global frame names. You can also use /stkid for a one-time identification without leaving hover mode enabled.", "GameFontHighlightSmall")
    local cbIdentifier = Window:CreateCheckbox(identifierPage, "Enable Hover Identifier", getGV("identifierEnabled"), setGV("identifierEnabled"), "Shows a small identifier tooltip while you move your cursor over UI frames.")
    cbIdentifier:SetPoint("TOPLEFT", idHeader, "BOTTOMLEFT", 0, -48)
    local cbIdentifierTooltip = Window:CreateCheckbox(identifierPage, "Show Identifier Tooltip", getGV("identifierTooltip"), setGV("identifierTooltip"), "Displays the current frame details near your cursor while hover identifier mode is enabled.")
    cbIdentifierTooltip:SetPoint("TOPLEFT", cbIdentifier, "BOTTOMLEFT", 0, -8)
    local cbIdentifierDetail = Window:CreateCheckbox(identifierPage, "Detailed Output", getGV("identifierDetailed"), setGV("identifierDetailed"), "Includes frame size, strata, level, alpha, point, and source-location details when the client exposes them.")
    cbIdentifierDetail:SetPoint("TOPLEFT", cbIdentifierTooltip, "BOTTOMLEFT", 0, -8)
    local bIdentify = Window:CreateButton(identifierPage, "Identify Cursor Frame", 180, 30, function() if SinsToolkit.Identifier then SinsToolkit.Identifier:IdentifyNow() end end, "Prints information about the frame currently under your cursor. Same as /stkid.")
    bIdentify:SetPoint("TOPLEFT", cbIdentifierDetail, "BOTTOMLEFT", 0, -18)
    local bIdentifierCopy = Window:CreateButton(identifierPage, "Copy Last Result", 160, 30, function() if SinsToolkit.Identifier then SinsToolkit.Identifier:CopyLast() end end, "Opens a copyable popup for the last identified frame.")
    bIdentifierCopy:SetPoint("LEFT", bIdentify, "RIGHT", 10, 0)

    self.frame = identifierPage
    return identifierPage
end

Page:Register("Identifier")

return Page