--[[
	Calculate the actual spot Frame position in studs by making use of adornee position.

	Parameters:
	- surfaceGui (SurfaceGui): SurfaceGui instance that the spot belongs to
	- spot (Frame): Frame instance representing a Spot

	Returns:
	- (Vector3): World position of the spot
]]

function CameraModule:getSpotPosition(surfaceGui, spot)
	local adornee = surfaceGui.Adornee
	local face = surfaceGui.Face

	-- Find offset of the spot's Frame from the center of the SurfaceGui (in studs)
	local spotCenter = spot.AbsolutePosition + (Vector2.new(0.5, 0.5) - spot.AnchorPoint) * spot.AbsoluteSize
	local guiOffset = (spotCenter - surfaceGui.AbsoluteSize / 2) / surfaceGui.PixelsPerStud

	-- Calculate the actual position of the center of spot (in studs)
	local spotPosition = adornee.CFrame:PointToWorldSpace(self:_getPointByFace(guiOffset, adornee, face))

	return spotPosition
end

function CameraModule:_tweenCamera(target)
	-- Animate to the spot
	local tweenTime = constants.CameraTweenTime
	local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
	local tween = self.tweenService:Create(self.camera, tweenInfo, { CFrame = target })

	tween:Play()

	task.wait(tweenTime)
end
