import { baseItemSchema } from "./_shared.mjs"

/**
 * DataModel pour les items de type "defense" (protections, armures, boucliers).
 * @augments {foundry.abstract.TypeDataModel}
 */
export default class VermineDefenseData extends foundry.abstract.TypeDataModel {
  /** @override */
  static LOCALIZATION_PREFIXES = ["VERMINE.item.defense"]

  /** @override */
  static defineSchema() {
    const fields = foundry.data.fields
    const reqInt = { required: true, nullable: false, integer: true }
    return {
      ...baseItemSchema(),
      level: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
      equipped: new fields.BooleanField({ required: true, initial: false }),
      specificLevel: new fields.SchemaField({
        label: new fields.StringField({ required: true, initial: "" }),
        level: new fields.NumberField({ ...reqInt, initial: 0, min: 0 })
      }),
      mobility: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
      isShield: new fields.BooleanField({ required: true, initial: false })
    }
  }
}
