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

import mezz.jei.api.recipe.RecipeType
import net.minecraft.world.entity.player.Inventory
import net.minecraft.world.inventory.MenuType
import net.minecraft.world.inventory.Slot
import ru.dbotthepony.mc.otm.block.entity.MatteryPoweredBlockEntity
import ru.dbotthepony.mc.otm.menu.MatteryPoweredMenu
import ru.dbotthepony.mc.otm.menu.UpgradeSlots
import ru.dbotthepony.mc.otm.menu.input.BooleanInputWithFeedback
import ru.dbotthepony.mc.otm.menu.input.EnergyConfigPlayerInput
import ru.dbotthepony.mc.otm.menu.input.ItemConfigPlayerInput
import ru.dbotthepony.mc.otm.menu.widget.ProfiledLevelGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.ProgressGaugeWidget
import ru.dbotthepony.mc.otm.menu.widget.TakeExperienceWidget
import java.util.function.Supplier

abstract class AbstractProcessingMachineMenu(
	type: MenuType<*>,
	containerID: Int,
	inventory: Inventory,
	tile: MatteryPoweredBlockEntity? = null
) : MatteryPoweredMenu(type, containerID, inventory, tile) {
	data class ProcessingTuple(
		val input: Slot,
		val output: Slot,
		val progress: ProgressGaugeWidget
	)

	abstract val processingTuples: List<ProcessingTuple>

	abstract val itemConfig: ItemConfigPlayerInput?
	abstract val energyConfig: EnergyConfigPlayerInput?
	abstract val profiledEnergy: ProfiledLevelGaugeWidget<*>
	abstract val balanceInputs: BooleanInputWithFeedback?
	abstract val upgrades: UpgradeSlots?
	abstract val experience: TakeExperienceWidget?

	open val recipeTypes: Supplier<List<RecipeType<*>>>?
		get() = null

	init {
		addInventorySlots()
	}
}
