package ocelot.desktop.ui.widget.slot

import ocelot.desktop.graphics.IconSource
import ocelot.desktop.inventory.traits.CpuLikeItem
import ocelot.desktop.inventory.{Inventory, Item}
import ocelot.desktop.util.ComputerAware
import totoro.ocelot.brain.util.Tier.Tier

class CpuSlotWidget(slot: Inventory#Slot, computer: ComputerAware, _tier: Tier) extends SlotWidget[CpuLikeItem](slot) {
  override def ghostIcon: Option[IconSource] = Some(IconSource.CpuIcon)
  override def slotTier: Option[Tier] = Some(_tier)

  protected override def onItemNotification(notification: Item.Notification): Unit = {
    super.onItemNotification(notification)

    notification match {
      case CpuLikeItem.CpuArchitectureChangedNotification =>
        computer.turnOn()
        computer.turnOff()

      case _ =>
    }
  }
}
