---@class DataPointStore
ExtraClasses.DataPointStore = {
	is_additive = false,
	result = 1,
	reg_factors = {},
	reg_on_changed = {},
}

---Contains many DataPoints
---@param input any
---@return any
--[[

	ExtraClasses.DataPointStore.new({
		DataPoints = {
			[name] = ExtraClasses.DataPoint.new(),
		}
	})
]]
function ExtraClasses.DataPointStore.new(input)
	local self
	local is_table = (type(input) == "table")
	if is_table then
		if input.DataPoints then
			self = input
		else
			self.DataPoints = input
		end
	else
		self = {}
	end
	-- copy if it's already setmetatable'd
	if self._on_changed then
		self = table.copy(self)
		if self.DataPoints then
			self.DataPoints = table.copy(self.DataPoints)
		end
	end
	if self.DataPoints then
		for name, datapoint in pairs(self.DataPoints) do
			datapoint = ExtraClasses.DataPoint.new(datapoint)
		end
	else
		self.DataPoints = {}
	end
	self = setmetatable(self, ExtraClasses.DataPointStore)
	return self
end

rawset(ExtraClasses.DataPointStore, "__index", ExtraClasses.DataPointStore)
rawset(ExtraClasses.DataPointStore, "__call", function(self, ...)
	return ExtraClasses.DataPointStore.new(...)
end)
