import { SYSTEM } from "../config/system.mjs"
export default class LethalFantasyMiracle extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields
    const requiredInteger = { required: true, nullable: false, integer: true }
    const schema = {}

    schema.description = new fields.HTMLField({
      required: false,
      blank: true,
      initial: "",
      textSearch: true,
    })
    schema.level = new fields.NumberField({
      ...requiredInteger,
      initial: 1,
      min: 1,
      max: 25,
    })
    schema.components = new fields.SchemaField({
      verbal: new fields.BooleanField(),
      somatic: new fields.BooleanField(),
      material: new fields.BooleanField(),
      catalyst: new fields.BooleanField(),
      religious: new fields.BooleanField()
    })
    schema.prayerTime = new fields.StringField({ required: true, initial: "" })
    schema.miracleRange = new fields.StringField({ required: true, initial: "" })
    schema.areaAffected = new fields.StringField({ required: true, initial: "" })
    schema.duration = new fields.StringField({ required: true, initial: "" })
    schema.savingThrow = new fields.StringField({ required: true, initial: "" })
    schema.materialComponent = new fields.StringField({ required: true, initial: "" })
    schema.catalyst = new fields.StringField({ required: true, initial: "" })
    schema.miracleType = new fields.StringField({ required: true, initial: "combat", choices: SYSTEM.MIRACLE_TYPES })

    schema.attackRoll = new fields.StringField({ required: true, initial: "" })
    schema.powerRoll = new fields.StringField({ required: true, initial: "" })
    schema.damageDice = new fields.StringField({ required: false, initial: "" })
    schema.damageDiceOverpowered = new fields.StringField({ required: false, initial: "" })
    schema.damageDiceOverpowered2 = new fields.StringField({ required: false, initial: "" })

    return schema
  }

  /** @override */
  static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Miracle"]
}
