-- This is basicly just a regular product, with the only exception
-- that it needs to be made invisible when a pie will be placed in the oven

class 'ovenbaseProduct' (regularProduct)

function ovenbaseProduct:__init(baseName) super(baseName)
end

function ovenbaseProduct:onWorkStart(task)

	if (getAppliance("rest3_oven"):hasSlotsOpen()) then
		Product.onWorkStart(self, task)
		self:moveToBubble()
		-- cout("hasSlotsOpen\n")
		return true
	else
		self:unQueue()
	end
	
	return false
		
end

function ovenbaseProduct:onBubbleCancel()

	self:unQueue()

end

function ovenbaseProduct:onBubbleMerged()
	self:unQueue()
	
	local products = 
	{
		"OREGANO",
		"CHIVES",
		"SALTPEPPER",
	}
	
	for i = 1, 3 do
		if (getProduct(products[i])) then
			if (getProduct(products[i]):isQueuedFirst()) then
				getProduct(products[i]):unQueue()
				break
			
			end	
		end	
	end
	
	regularProduct.onBubbleMerged(self)
	
end