package ru.dbotthepony.mc.otm.capability.drive

import net.minecraft.nbt.CompoundTag
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.storage.IStorageComponent
import ru.dbotthepony.mc.otm.storage.IStorageStack
import ru.dbotthepony.mc.otm.storage.IStorageTuple
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper
import java.math.BigInteger
import java.util.*

interface IItemMatteryDrive : IMatteryDrive<ItemStackWrapper> {
	/**
	 * @param item
	 * @return all items belonging to passed class
	 */
	fun findItems(item: Item): Collection<IStorageTuple<ItemStackWrapper>>

	/**
	 * @param stack
	 * @return [ItemStack] that match specified [stack] (item type, nbt tag)
	 */
	fun findItems(stack: ItemStack): IStorageTuple<ItemStackWrapper>?
}

interface IMatteryDrive<T : IStorageStack> : IStorageComponent<T> {
	val uuid: UUID

	var isDirty: Boolean

	val storedCount: BigInteger
	val driveCapacity: BigInteger

	// not extending INBTSerializable to avoid serializing it as forgecaps
	fun serializeNBT(): CompoundTag
	fun deserializeNBT(nbt: CompoundTag)
}
