package ru.dbotthepony.mc.otm.client.screen.tech

import net.minecraft.network.chat.Component
import ru.dbotthepony.mc.otm.menu.tech.BatteryBankMenu
import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
import ru.dbotthepony.mc.otm.client.screen.panels.slot.BatterySlotPanel
import ru.dbotthepony.mc.otm.client.screen.panels.FramePanel
import ru.dbotthepony.mc.otm.client.screen.panels.button.makeDeviceControls
import ru.dbotthepony.mc.otm.client.screen.widget.WideProfiledPowerGaugePanel

class BatteryBankScreen(menu: BatteryBankMenu, p_97742_: Inventory, p_97743_: Component) :
	MatteryScreen<BatteryBankMenu>(menu, p_97742_, p_97743_) {

	override fun makeMainFrame(): FramePanel<MatteryScreen<*>> {
		val frame = super.makeMainFrame()!!

		WideProfiledPowerGaugePanel(this, frame, menu.powerLevel, LEFT_MARGIN, GAUGE_TOP_WITHOUT_SLOT)

		for (i in 0 .. 5)
			BatterySlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * i, 32f)

		for (i in 6 .. 11)
			BatterySlotPanel(this, frame, menu.storageSlots[i], 44f + 18 * (i - 6), 32f + 18f)

		makeDeviceControls(this, frame, redstoneConfig = menu.redstone, energyConfig = menu.energyConfig, itemConfig = menu.itemConfig)

		return frame
	}
}
