import MaleficesItemSheet from "./base-item-sheet.mjs"
import { MaleficesUtility } from "../../malefices-utility.js"

export default class MaleficesArchetypeSheet extends MaleficesItemSheet {
  static DEFAULT_OPTIONS = {
    classes: ["archetype"],
    position: { width: 620 },
    window: { contentClasses: ["archetype-content"] },
  }

  static PARTS = {
    main: { template: "systems/fvtt-malefices/templates/items/item-archetype-sheet.hbs" },
  }

  tabGroups = { primary: "details" }

  #getTabs() {
    const tabs = {
      details: { id: "details", group: "primary", label: "Détails" },
      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
  }

  async _prepareContext() {
    const context = await super._prepareContext()
    context.tabs = this.#getTabs()
    context.tarots = MaleficesUtility.getTarots()
    return context
  }
}
