extends PanelContainer

signal printer_purchase_requested(printer_data: PrinterData)

@export var printers_array: Array[PrinterData]
const PRINTER_SCENE = preload("uid://bdpqvwvwmaian")

func _ready() -> void:
	for printer in printers_array:
		var new_printer = PRINTER_SCENE.instantiate()
		$PrinterList.add_child(new_printer)
		new_printer.initialize_printer(printer)
		new_printer.buy_printer.connect(_buy_printer_pressed)
	
	printer_purchase_requested.connect(GameData._on_shop_printer_purchase_req)

func _buy_printer_pressed(bought_printer) -> void:
	printer_purchase_requested.emit(bought_printer.printer_data)
