package ocelot.desktop.inventory.item

import ocelot.desktop.graphics.IconSource
import ocelot.desktop.inventory.traits.{CardItem, ComponentItem, PersistableItem}
import ocelot.desktop.inventory.{Item, ItemFactory, ItemRecoverer}
import totoro.ocelot.brain.entity.NetworkCard
import totoro.ocelot.brain.entity.traits.Entity
import totoro.ocelot.brain.util.Tier
import totoro.ocelot.brain.util.Tier.Tier

class NetworkCardItem(val card: NetworkCard) extends Item with ComponentItem with PersistableItem with CardItem {
  override def component: Entity with NetworkCard = card

  override def factory: ItemFactory = NetworkCardItem.Factory
}

object NetworkCardItem {
  object Factory extends ItemFactory {
    override type I = NetworkCardItem

    override def itemClass: Class[I] = classOf

    override def name: String = "Network Card"
    override def tier: Option[Tier] = Some(Tier.One)
    override def icon: IconSource = IconSource.NetworkCard

    override def build(): NetworkCardItem = new NetworkCardItem(new NetworkCard)

    override def recoverers: Iterable[ItemRecoverer[_, _]] = Some(ItemRecoverer(new NetworkCardItem(_)))
  }
}
