package ch.dissem.yaep.domain


class Item<C : ItemClass<C>>(
    val itemType: C,
    val symbol: String = itemType.symbols.random()
) : Comparable<Item<C>> {
    constructor(itemType: C) : this(itemType, itemType.symbols.random())

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is Item<*>) return false
        return itemType == other.itemType
    }

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

    override fun toString(): String {
        return itemType.toString() + symbol
    }

    override fun compareTo(other: Item<C>): Int = itemType.compareTo(other.itemType)
}
