---@type Orbit
local Orbit = Orbit

local Plugin = Orbit:RegisterPlugin("Focus Debuffs", "Orbit_FocusDebuffs", {
    liveToggle = true,
    defaults = Orbit.UnitAuraGridMixin.sharedDebuffDefaults,
})

Mixin(Plugin, Orbit.AuraMixin)
Mixin(Plugin, Orbit.UnitAuraGridMixin)

function Plugin:IsEnabled()
    local enabled = Orbit:ReadPluginSetting("Orbit_FocusFrame", Enum.EditModeUnitFrameSystemIndices.Focus, "EnableDebuffs")
    return enabled ~= false
end

function Plugin:AddSettings(dialog, systemFrame) self:AddAuraGridSettings(dialog, systemFrame) end

function Plugin:OnLoad()
    self:CreateAuraGridPlugin({
        unit = "focus", auraFilter = "HARMFUL|PLAYER", isHarmful = true,
        frameName = "OrbitFocusDebuffsFrame", editModeName = "Focus Debuffs",
        anchorParent = "OrbitFocusFrame", anchorGap = -50,
        defaultX = -200, defaultY = -240, initialWidth = 200, initialHeight = 40,
        changeEvent = "PLAYER_FOCUS_CHANGED", maxRowsMax = 6,
        showTimer = true, enablePandemic = true,
        exposeMountedConfig = true,
        vePluginName = "Focus Frame",
    })
    Orbit.EventBus:On("FOCUS_SETTINGS_CHANGED", function() self:UpdateVisibility() end, self)
end
