import OathHammerItemSheet from "./base-item-sheet.mjs"
import { SYSTEM } from "../../config/system.mjs"

export default class OathHammerSkillNPCSheet extends OathHammerItemSheet {
  /** @override */
  static DEFAULT_OPTIONS = {
    classes: ["skillnpc"],
    position: { width: 460 },
    window: { contentClasses: ["skillnpc-content"] },
  }

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

  /** @override */
  async _prepareContext() {
    const context = await super._prepareContext()
    // Build dicePool selector (0–20)
    context.dicePoolChoices = Object.fromEntries(
      Array.from({ length: 21 }, (_, i) => [i, String(i)])
    )
    // Color choices (localized labels)
    context.colorChoices = Object.fromEntries(
      Object.entries(SYSTEM.DICE_COLOR_TYPES).map(([k, v]) => [k, game.i18n.localize(v)])
    )
    // Skill reference choices (optional)
    context.skillRefChoices = {
      "": `— ${game.i18n.localize("OATHHAMMER.Label.None")} —`,
      ...Object.fromEntries(
        Object.entries(SYSTEM.SKILLS).map(([k, v]) => [k, game.i18n.localize(v.label)])
      )
    }
    return context
  }
}
