export class TeDeumArmureSchema extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields;
    const requiredInteger = { required: true, nullable: false, integer: true };
    const requiredDouble = { required: true, nullable: false, integer: false };

    const schema = {};

    schema.localisation = new fields.SchemaField(
      Object.values(game.system.tedeum.config.LOCALISATION).reduce((obj, loc) => {
        obj[loc.id] = new fields.SchemaField({
          protege: new fields.BooleanField({initial: false}),         
        });
        return obj;
      }, {})
    );
    
    schema.protection = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 });

    schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 });
    schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" });
    
    schema.equipe = new fields.BooleanField({initial: false}),         

    schema.description = new fields.HTMLField({ required: true, blank: true });

    return schema;
  }
}
