import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE, TEMPLATE_EQUIPEMENT } from "../common/_module.mjs";
import { STRING } from "../common/field-types.mjs";

const fields = foundry.data.fields;

export default class RdDModelArme extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    return Object.assign({},
      TEMPLATE_DESCRIPTION.fields(),
      TEMPLATE_INVENTAIRE.fields(),
      TEMPLATE_EQUIPEMENT.fields(),
      {
        resistance: new fields.NumberField({ label: "Résistance", initial: 1, integer: true, min: 0, required: true, nullable: false }),
        categorie_parade: new fields.StringField({ label: "Catégorie de parade", initial: "", ...STRING }),
        dommages: new fields.StringField({ label: "Dommages", initial: "0", ...STRING }),
        mortalite: new fields.StringField({ label: "Mortalité", initial: "mortel", ...STRING }),
        penetration: new fields.NumberField({ label: "Pénétration", initial: 0, integer: true, required: true, nullable: false }),
        force: new fields.StringField({ label: "Force min.", initial: "0", ...STRING }),
        competence: new fields.StringField({ label: "Compétence de mêlée", initial: "", ...STRING }),
        lancer: new fields.StringField({ label: "Compétence de lancer", initial: "", ...STRING }),
        tir: new fields.StringField({ label: "Compétence de tir", initial: "", ...STRING }),
        portee_courte: new fields.NumberField({ label: "Portée courte", initial: 0, integer: true, required: true, nullable: false }),
        portee_moyenne: new fields.NumberField({ label: "Portée moyenne", initial: 0, integer: true, required: true, nullable: false }),
        portee_extreme: new fields.NumberField({ label: "Portée extrême", initial: 0, integer: true, required: true, nullable: false }),
        magique: new fields.BooleanField({ label: "Magique", initial: false }),
        ecaille_efficacite: new fields.NumberField({ label: "Écailles d'Efficacité", initial: 0, integer: true, required: true, nullable: false }),
        resistance_magique: new fields.NumberField({ label: "Résistance magique", initial: 0, integer: true, required: true, nullable: false }),
        rapide: new fields.BooleanField({ label: "Arme rapide", initial: false }),
        deuxmains: new fields.BooleanField({ label: "Deux mains", initial: false }),
        unemain: new fields.BooleanField({ label: "Une main", initial: false }),
        initpremierround: new fields.StringField({ label: "Init. premier round", initial: "", ...STRING }),
      }
    )
  }
}
