class 'deliverkeyproduct' (Product)

deliverkeyproduct.keyProduct = nil

function deliverkeyproduct:__init(root) super(root)

end

function deliverkeyproduct:onClick()
	if (self:isSelected() == false) then		
		Product.onClick(self)
		self:setSelected(true)
	end
end

function deliverkeyproduct:onWorkComplete(task)
	
	self:setSelected(false)
	
	local product = getProduct(self.keyProduct)
	if (product ~= nil) then
		if (restaurant.keySpecial ~= nil) then
			restaurant.keySpecial.numDeliverKeys = restaurant.keySpecial.numDeliverKeys + 1
		elseif (getAppliance("rest2_elevator") ~= nil) then
			getAppliance("rest2_elevator").numDropKeys = getAppliance("rest2_elevator").numDropKeys + 1
		end
		product:incStock()
		product:setVisible(true)
	else
		cout("COULD NOT FIND PRODUCT FOR " .. self:getBase() .."\n")
	end
	
	self:setVisible(false) 
	self:setClickable(false)
end
