/**
 * Donjon & Cie - Systeme FoundryVTT
 *
 * Donjon & Cie est un jeu de role edite par John Doe.
 * Ce systeme FoundryVTT est une implementation independante et n'est pas
 * affilie a John Doe.
 *
 * @author    LeRatierBretonnien
 * @copyright 2025–2026 LeRatierBretonnien
 * @license   CC BY-NC-SA 4.0 – https://creativecommons.org/licenses/by-nc-sa/4.0/
 */

export default class PnjDataModel extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields;
    const makeAttack = () => new fields.SchemaField({
      nom: new fields.StringField({ initial: "Attaque" }),
      degats: new fields.StringField({ initial: "1d6" }),
      notes: new fields.StringField({ initial: "" })
    });

    return {
      espece: new fields.StringField({ initial: "" }),
      categorie: new fields.StringField({ initial: "Resident" }),
      role: new fields.StringField({ initial: "" }),
      resume: new fields.StringField({ initial: "" }),
      sante: new fields.SchemaField({
        dv: new fields.StringField({ initial: "1d8" }),
        pv: new fields.SchemaField({
          value: new fields.NumberField({ initial: 6, integer: true }),
          max: new fields.NumberField({ initial: 6, integer: true })
        })
      }),
      defense: new fields.SchemaField({
        armure: new fields.SchemaField({
          delta: new fields.NumberField({ initial: 0, integer: true }),
          resultatProtection: new fields.NumberField({ initial: 0, integer: true })
        }),
        courage: new fields.SchemaField({
          delta: new fields.NumberField({ initial: 0, integer: true })
        })
      }),
      attaque: makeAttack(),
      attaques: new fields.ArrayField(makeAttack(), {
        initial: [{ nom: "Attaque", degats: "1d6", notes: "" }]
      }),
      pouvoirsSpeciaux: new fields.HTMLField({ initial: "" }),
      description: new fields.HTMLField({ initial: "" }),
      notes: new fields.HTMLField({ initial: "" })
    };
  }
}
