import MournbladeItemSheet from "./base-item-sheet.mjs"

export default class MournbladePotionSheet extends MournbladeItemSheet {
  /** @override */
  static DEFAULT_OPTIONS = {
    classes: ["potion"],
    position: {
      width: 640,
    },
    window: {
      contentClasses: ["potion-content"],
    },
  }

  /** @override */
  static PARTS = {
    main: {
      template: "systems/fvtt-mournblade/templates/item-potion-sheet.hbs",
    },
  }

  /** @override */
  tabGroups = {
    primary: "details",
  }

  #getTabs() {
    const tabs = {
      details: { id: "details", group: "primary", label: "Détails" },
      effets: { id: "effets", group: "primary", label: "Effets" },
      description: { id: "description", group: "primary", label: "Description" },
    }
    for (const v of Object.values(tabs)) {
      v.active = this.tabGroups[v.group] === v.id
      v.cssClass = v.active ? "active" : ""
    }
    return tabs
  }

  /** @override */
  async _prepareContext() {
    const context = await super._prepareContext()
    context.tabs = this.#getTabs()
    context.config = game.system.mournblade.config
    return context
  }
}
