import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"
import CommonTemplate from "./common-template.mjs"
import { HTMLSTRING } from "./field-types.mjs"

const fields = foundry.data.fields

export class CommonDescription extends CommonTemplate {
  fields() {
    return {
      description: new fields.HTMLField({ ...HTMLSTRING }),
      descriptionmj: new fields.HTMLField({ gmOnly: true, ...HTMLSTRING })
    }
  }

  handlebars() {
    return [
      "systems/foundryvtt-reve-de-dragon/templates/sheets/item/common/template-description.hbs",
    ]
  }
  actions() {
    return {}
  }

  async prepareContext(item) {
    const enriched = {
      description: await RdDTextEditor.enrichHTML(item.system.description, item),
      descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
    }
    return { enriched }
  }

}
