import { SYSTEM } from "../config/system.mjs"

export default class HamalronSortilege extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields
    const schema = {}

    schema.description = new fields.HTMLField({ required: true, textSearch: true })
    schema.categorie = new fields.StringField({ required: true, initial: "domestique", choices: Object.fromEntries(Object.entries(SYSTEM.SORTILEGE_CATEGORIES).map(([key, val]) => [key, val.label])) })
    schema.niveauRequis = new fields.StringField({ required: true, initial: "amateur", choices: Object.fromEntries(Object.entries(SYSTEM.NIVEAU_COMPETENCES).map(([key, val]) => [key, val.name])) })
    schema.portee = new fields.StringField({ required: false, initial: "" })
    schema.duree = new fields.StringField({ required: false, initial: "" })
    schema.conditions = new fields.StringField({ required: false, initial: "" })
    schema.effetAmateur = new fields.HTMLField({ required: false, textSearch: true })
    schema.effetCompetent = new fields.HTMLField({ required: false, textSearch: true })
    schema.effetExpert = new fields.HTMLField({ required: false, textSearch: true })
    schema.concentration = new fields.BooleanField({ required: true, initial: false })
    return schema
  }

  /** @override */
  static LOCALIZATION_PREFIXES = ["HAMALRON.Sortilege"]
}
