import MGNERoll from "./roll.mjs"
import { SYSTEM } from "../config/system.mjs"

export default class MGNEItem extends Item {
  prepareBaseData() {
    super.prepareBaseData()
    const fallbackIcon = SYSTEM.itemTypes[this.type]?.icon
    if (!fallbackIcon) return
    if (!this._source.img || this._source.img === "icons/svg/item-bag.svg") {
      this.updateSource({ img: fallbackIcon })
    }
  }

  async rollUsage() {
    return MGNERoll.rollUsage(this)
  }
}
