import YggdrasillActorSheet from "./base-actor-sheet.mjs"

export default class YggdrasillFigurantSheet extends YggdrasillActorSheet {
  /** @override */
  static DEFAULT_OPTIONS = {
    ...super.DEFAULT_OPTIONS,
    classes: [...super.DEFAULT_OPTIONS.classes, "figurant"],
    window: {
      ...super.DEFAULT_OPTIONS.window,
      title: "Feuille de Figurant",
    },
  }

  /** @override */
  static PARTS = {
    sheet: {
      template: "systems/fvtt-yggdrasill/templates/actor-figurant-sheet.hbs",
    },
  }

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

  /** @override */
  async _prepareContext() {
    const context = await super._prepareContext()
    const actor = this.document

    // System fields for formInput helpers
    context.systemFields = actor.system.schema.fields

    // Enrich HTML fields
    context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.description || "", { async: true })
    context.enrichedNotes = await foundry.applications.ux.TextEditor.implementation.enrichHTML(actor.system.biodata?.notes || "", { async: true })

    return context
  }
}
