local _AddonName, _EchoRaidTools = ...;


local module = _EchoRaidTools:GetModule("EditModeTools")

local db

function module:DBSetup()
    EchoRaidToolsDB.EditModeTools = EchoRaidToolsDB.EditModeTools or {}
    db = EchoRaidToolsDB.EditModeTools
    db.Profiles = db.Profiles or {}
    db.Enabled = db.Enabled or false
end

function module:GetDB()
    return db
end

function module:GetStoredSettingsForProfile(profileName)
    if not db.Profiles[profileName] then
        db.Profiles[profileName] = {}
        local profile = db.Profiles[profileName]
        profile.Spec = {}
        profile.Spec.Enabled = false
        profile.Spec.Specs = {}
        ---profile.Spec.Specs[123] = true
        profile.GroupSize = {}
        profile.GroupSize.Enabled = false
        profile.GroupSize.Min = 1
        profile.GroupSize.Max = 40
    end
    if not db.Profiles[profileName].InstanceType then
        local profile = db.Profiles[profileName]
        profile.InstanceType = {}
        profile.InstanceType.Enabled = false
        profile.InstanceType.InstanceTypes = {}
    end
    return db.Profiles[profileName]
end

function module:GetModuleState()
    return db.Enabled
end

function module:ToggleModuleState()
    db.Enabled = not db.Enabled
    module:UpdateEventHandler()
end
