-- dependencies : (dictionary<string, table>) a map of requirements
-- dependencies.networking : (table) an object that implements POST and returns a promise

function GAReporter.new(dependencies)
	local reporter = {
		-- trackingId sends the data to the right GA property.
		trackingId = PROPERTY_ID,

		-- userId is meant to help identify recurring users,
		-- If you plan on using GAReporter on a per-client basis, you should set this value
		userId = HttpService:GenerateGUID(),

		-- clientId is meant to identify a given session that data is coming from.
		clientId = HttpService:GenerateGUID(),

		-- our HTTP handler
		_networking = dependencies.networking,
	}
	setmetatable(reporter, GAReporter)

	return reporter
end

function GAReporter:setUserId(userId)
	assert(type(userId) == "string", "userId must be a string")
	self.userId = userId
end
