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

    schema.description = new fields.HTMLField({ required: true, textSearch: true })
    schema.defense = new fields.StringField({ required: true, initial: "d4", choices: SYSTEM.SHIELD_DEFENSE_DICE })
    schema.movementreduction = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
    schema.hascover = new fields.BooleanField({ required: true, initial: false })
    schema.damageReduction = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })

    schema.standing = new fields.SchemaField({
      min: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
      max: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
    })
    schema.crouching = new fields.SchemaField({
      min: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
      max: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
    })

    schema.destruction = new fields.SchemaField({
      bashing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
      slashing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
      piercing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
    })
    schema.autodestruction = new fields.SchemaField({
      bashing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
      slashing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }),
      piercing: new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
    })

    schema.encLoad = new fields.NumberField({ required: true, initial: 0, min: 0 })
    schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
    schema.money = new fields.StringField({ required: true, initial: "tinbit", choices: SYSTEM.MONEY })
    schema.equipped = new fields.BooleanField({ required: true, initial: false })

    return schema
  }

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

}
