--[[
	Keeps track of a single spot on a surface canvas. Manages the art item on a single spot, and
	the owner of the art item.
]]

local HttpService = game:GetService("HttpService")

local Spot = {}
Spot.__index = Spot

function Spot.new()
	local self = {
		id = HttpService:GenerateGUID(false),

		-- ID of the applied art
		artId = nil,

		ownerUserId = nil,

		-- Event to fire as a callback whenever the art on this spot changes.
		onArtChanged = nil,
	}

	setmetatable(self, Spot)

	return self
end

function Spot:applyArt(player, artId)
	self.artId = artId
	self.ownerUserId = player.UserId

	if self.onArtChanged then
		self.onArtChanged(self.artId, self.ownerUserId)
	end
end
