package ru.dbotthepony.mc.otm.menu.tech

import net.minecraft.world.entity.player.Inventory
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerBlockEntity
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerMiddleBlockEntity
import ru.dbotthepony.mc.otm.block.entity.tech.AndroidChargerTopBlockEntity
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
import ru.dbotthepony.mc.otm.registry.MMenus

class AndroidChargerMenu : MatteryPoweredMenu {
	val energyConfig: EnergyConfigPlayerInput
	val profiledEnergy: ProfiledLevelGaugeWidget<*>

	constructor(
		p_38852_: Int,
		inventory: Inventory,
		tile: AndroidChargerBlockEntity? = null
	) : super(MMenus.ANDROID_CHARGER, p_38852_, inventory, tile) {
		energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig)
		profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.energyConfig?.energy, energyWidget)
	}

	constructor(
		p_38852_: Int,
		inventory: Inventory,
		tile: AndroidChargerTopBlockEntity? = null
	) : super(MMenus.ANDROID_CHARGER, p_38852_, inventory, tile?.lastTileEntity) {
		energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig)
		profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.lastTileEntity?.energyConfig?.energy, energyWidget)
	}

	constructor(
		p_38852_: Int,
		inventory: Inventory,
		tile: AndroidChargerMiddleBlockEntity? = null
	) : super(MMenus.ANDROID_CHARGER, p_38852_, inventory, tile?.lastTileEntity) {
		energyConfig = EnergyConfigPlayerInput(this, tile?.energyConfig)
		profiledEnergy = ProfiledLevelGaugeWidget(this, tile?.lastTileEntity?.energyConfig?.energy, energyWidget)
	}

	init {
		addStorageSlot(batterySlot)
		addInventorySlots()
	}
}
