/**
 * Template de base pour tous les items
 */
export class BaseItemModel extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields;
    return {
      description: new fields.HTMLField({ initial: "" })
    };
  }
}

/**
 * Template pour les équipements de base
 */
export class BaseEquipItemModel extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields;
    return {
      prixpo: new fields.NumberField({ initial: 0, integer: true }),
      prixca: new fields.NumberField({ initial: 0, integer: true }),
      prixsc: new fields.NumberField({ initial: 0, integer: true }),
      rarete: new fields.NumberField({ initial: 0, integer: true }),
      quantite: new fields.NumberField({ initial: 1, integer: true }),
      equipped: new fields.BooleanField({ initial: false })
    };
  }
}

/**
 * Template pour l'automatisation
 */
export class AutomationItemModel extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields;
    return {
      isautomated: new fields.BooleanField({ initial: false }),
      automations: new fields.ArrayField(
        new fields.SchemaField({
          id: new fields.StringField({ initial: "" }),
          eventtype: new fields.StringField({ initial: "on-drop" }),
          name: new fields.StringField({ initial: "" }),
          bonusname: new fields.StringField({ initial: "vigueur" }),
          bonus: new fields.NumberField({ initial: 0, integer: true }),
          competence: new fields.StringField({ initial: "" }),
          minLevel: new fields.NumberField({ initial: 0, integer: true }),
          baCost: new fields.NumberField({ initial: 0, integer: true })
        }),
        { initial: [] }
      )
    };
  }
}
