package ru.dbotthepony.mc.otm.storage.optics

import ru.dbotthepony.mc.otm.storage.IStorageAcceptor
import ru.dbotthepony.mc.otm.storage.StorageStack
import java.util.function.IntSupplier

class InsertPriority<S : StorageStack<S>>(private val parent: IStorageAcceptor<S>, private val priority: IntSupplier) : IStorageAcceptor<S> by parent {
	override val insertPriority: Int
		get() = priority.asInt

	override fun equals(other: Any?): Boolean {
		return other is InsertPriority<*> && parent == other.parent
	}

	override fun hashCode(): Int {
		return parent.hashCode()
	}

	override fun toString(): String {
		return "InsertPriority[$parent with $priority]"
	}
}
