import { listItemSchema, learnSchema, levelSchema } from "./_shared.mjs"

/**
 * DataModel pour les items de type "ability" (capacités, pouvoirs).
 * @augments {foundry.abstract.TypeDataModel}
 */
export default class VermineAbilityData extends foundry.abstract.TypeDataModel {
  /** @override */
  static LOCALIZATION_PREFIXES = ["VERMINE.item.ability"]

  /** @override */
  static defineSchema() {
    const fields = foundry.data.fields
    return {
      ...listItemSchema(),
      type: new fields.StringField({ required: true, initial: "" }),
      totem: new fields.StringField({ required: true, initial: "" }),
      learn: learnSchema(),
      level: levelSchema(1, 1, 3),
      learned: new fields.BooleanField({ required: true, initial: false }),
      effects: new fields.ArrayField(new fields.StringField({ required: true, initial: "" }), {
        initial: []
      })
    }
  }
}
