---@type Diesal.GUI
local DiesalGUI = LibStub("DiesalGUI-2.0")
---@type Diesal.Tools
local DiesalTools = LibStub("DiesalTools-2.0")
---@type Diesal.Style
local DiesalStyle = LibStub("DiesalStyle-2.0")

local Type = "DiesalAccordian"

local Version = 2

---@type Diesal.Style.Stylesheet
local Stylesheet = {
    ["frame-background"] = {
        type = "texture",
        color = "FF0000",
    },
}

---@class Diesal.GUI.Accordian.Methods
local methods = {

    ---@param self DiesalAccordian
    OnAcquire = function(self)
        -- self:SetStylesheet(Stylesheet)
        -- self:SetStylesheet(wireFrameSheet)
        self:ResetSettings(true)
        self:Show()
    end,

    ---@param self DiesalAccordian
    OnRelease = function(self) end,

    ---@param self DiesalAccordian
    ApplySettings = function(self) end,

    ---@param self DiesalAccordian
    CollapseAll = function(self)
        for i = 1, #self.children do
            self.children[i]:Collapse()
        end
    end,

    ---@param self DiesalAccordian
    ExpandAll = function(self)
        for i = 1, #self.children do
            self.children[i]:Expand()
        end
    end,
}

---@class DiesalAccordian : Diesal.GUI.Object.Accordian

local function Constructor()
    ---@class Diesal.GUI.Object.Accordian : Diesal.GUI.ObjectBase, Diesal.GUI.Accordian.Methods
    ---@field content Frame
    ---@field children DiesalAccordianSection[]
    local self = DiesalGUI:Create(Type, true)

    self.isContainer = true

    local frame = CreateFrame("Frame", nil, UIParent)
    self.frame = frame

    self.defaults = {}
    -- Events
    -- OnAcquire, OnRelease, OnHeightSet, OnWidthSet
    -- OnHeightChange

    local content = self:CreateRegion("Frame", "content", frame)
    content:SetAllPoints()

    -- ~~ Methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    self:SetMethods(methods)
    --[[ for method, func in pairs(methods) do
        self[method] = func
    end ]]
    -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    return self
end
DiesalGUI:RegisterObjectConstructor(Type, Constructor, Version)
