local _, private = ...
if private.shouldSkip() then return end

--[[ Lua Globals ]]
-- luacheck: globals _G

--[[ Core ]]
local Aurora = private.Aurora
local Base = Aurora.Base
local Skin = Aurora.Skin
local Color, Util = Aurora.Color, Aurora.Util

--[[ do AddOns\Blizzard_AdventureMap.lua
end ]]

do --[[ AddOns\Blizzard_AdventureMap.xml ]]
    function Skin.AdventureMapQuestRewardTemplate(Button)
        Base.CropIcon(Button.Icon, Button)

        Button.ItemNameBG:SetAlpha(0)
        local nameBG = _G.CreateFrame("Frame", nil, Button)
        nameBG:SetPoint("TOPLEFT", Button.Icon, "TOPRIGHT", 2, 1)
        nameBG:SetPoint("BOTTOMRIGHT")
        Base.SetBackdrop(nameBG, Color.frame)
    end
    function Skin.AdventureMapInsetTemplate(Frame)
        Frame.ExpandedFrame.Border:Hide()
        Frame.CollapsedFrame.TextBackground:SetAlpha(0)
        Skin.UIPanelCloseButton(Frame.ExpandedFrame.CloseButton)
    end
end

function private.AddOns.Blizzard_AdventureMap()
    ----====####################====----
    --   Blizzard_AdventureMapUtils   --
    ----====####################====----


    ----====####################====----
    --   AM_ZoneSummaryDataProvider   --
    ----====####################====----


    ----====####################====----
    --         AM_QuestDialog         --
    ----====####################====----
    local AdventureMapQuestChoiceDialog = _G.AdventureMapQuestChoiceDialog

    Util.WrapPoolAcquire(AdventureMapQuestChoiceDialog.rewardPool, "AdventureMapQuestRewardTemplate")

    -- AdventureMapFrame is no longer a named global; the pool is created inside
    -- AdventureMapMixin:OnLoad, so hook the mixin to wrap it after it is set up.
    _G.hooksecurefunc(_G.AdventureMapMixin, "OnLoad", function(self)
        Util.WrapPoolAcquire(self:GetMapInsetPool(), "AdventureMapInsetTemplate")
    end)

    AdventureMapQuestChoiceDialog.Rewards:SetAlpha(0)
    AdventureMapQuestChoiceDialog.Background:Hide()

    Skin.FrameTypeFrame(AdventureMapQuestChoiceDialog)
    AdventureMapQuestChoiceDialog:SetBackdropOption("offsets", {
        left = 3,
        right = 3,
        top = 14,
        bottom = -1,
    })

    Skin.UIPanelCloseButton(AdventureMapQuestChoiceDialog.CloseButton)

    local ScrollBar = AdventureMapQuestChoiceDialog.Details.ScrollBar
    Skin.FrameTypeScrollBar(ScrollBar)
    if ScrollBar.Top then ScrollBar.Top:Hide() end
    if ScrollBar.Bottom then ScrollBar.Bottom:Hide() end
    if ScrollBar.Middle then ScrollBar.Middle:Hide() end
    if ScrollBar.Background then ScrollBar.Background:Hide() end

    Skin.UIPanelButtonTemplate(AdventureMapQuestChoiceDialog.DeclineButton)
    Skin.UIPanelButtonTemplate(AdventureMapQuestChoiceDialog.AcceptButton)


    ----====####################====----
    --   AM_QuestChoiceDataProvider   --
    ----====####################====----


    ----====#####################====----
    --    AM_QuestOfferDataProvider    --
    ----====#####################====----


    ----====####################====----
    --     AM_MissionDataProvider     --
    ----====####################====----


    ----====####################====----
    --   Blizzard_AdventureMapInset   --
    ----====####################====----


    ----====#####################====----
    --      Blizzard_AdventureMap      --
    ----====#####################====----

end
