local Store = require(script.Store)

local NexusData = {}
NexusData.Version = "0.1.0"
NexusData._stores = {}

function NexusData.CreateStore(name, template, options)
    assert(not NexusData._stores[name], ("store '%s' already exists"):format(name))
    local store = Store.new(name, template, options)
    NexusData._stores[name] = store
    store:StartAutosave()
    return store
end

function NexusData.GetStore(name)
    return NexusData._stores[name]
end

function NexusData.CloseAll()
    for _, store in pairs(NexusData._stores) do
        store:Close()
    end
end

return NexusData
