--[[
	Encapsulates logic to apply art onto a single spot owned by the user.

	Parameters:
	- spotId (string): ID of spot to apply art to
	- artId (string): art ID to apply for the spot
]]

function PlayerSpots:applyArt(player, spotId, artId)
	local placedSpot = nil
	for _, value in ipairs(self.placedSpots) do
		if value.spot.id == spotId then
			placedSpot = value
			break
		end
	end

	if not placedSpot then
		return false, constants.Errors.SpotNotFound
	end

	-- Remove old art
	if self.toRemove then
		local placedSpotToRemove = self.placedSpots[self.toRemove]
		placedSpotToRemove.spot:removeArt()
		self.toRemove = nil
	end

	placedSpot.spot:applyArt(player, artId)

	return true, nil
end
