import { STRING, HTMLSTRING, INTEGER } from "../common/field-types.mjs";

const fields = foundry.data.fields;

export default class RdDModelVehicule extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    return {
      categorie: new fields.StringField({ initial: "", ...STRING }),
      vitesse: new fields.StringField({ initial: "", ...STRING }),
      bonus: new fields.StringField({ initial: "", ...STRING }),
      manoeuvrabilite: new fields.StringField({ initial: "", ...STRING }),
      equipage: new fields.NumberField({ initial: 0, ...INTEGER }),
      capacite_encombrement: new fields.NumberField({ initial: 0.0, integer: false }),
      etat: new fields.SchemaField({
        resistance: new fields.SchemaField({
          type: new fields.StringField({ initial: "number" }),
          max: new fields.NumberField({ initial: 20, integer: true }),
          value: new fields.NumberField({ initial: 20, integer: true }),
          label: new fields.StringField({ initial: "Résistance" }),
          derivee: new fields.BooleanField({ initial: false }),
        }),
        structure: new fields.SchemaField({
          type: new fields.StringField({ initial: "number" }),
          max: new fields.NumberField({ initial: 10, integer: true }),
          value: new fields.NumberField({ initial: 10, integer: true }),
          label: new fields.StringField({ initial: "Structure" }),
          derivee: new fields.BooleanField({ initial: false }),
        }),
      }),
      description: new fields.HTMLField({ initial: "", ...HTMLSTRING }),
      race: new fields.StringField({ initial: "", ...STRING }),
      notesmj: new fields.HTMLField({ initial: "", ...HTMLSTRING }),
    };
  }
}
