/**
 * Data model for Character actors
 */
export default class BoLCharacterDataModel extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields;
    const requiredInteger = { required: true, nullable: false, integer: true };
    
    return {
      // Details
      details: new fields.SchemaField({
        biography: new fields.HTMLField({ initial: "" }),
        notes: new fields.HTMLField({ initial: "" }),
        height: new fields.StringField({ initial: "" }),
        age: new fields.StringField({ initial: "" }),
        weight: new fields.StringField({ initial: "" }),
        hair: new fields.StringField({ initial: "" }),
        eyes: new fields.StringField({ initial: "" }),
        signs: new fields.StringField({ initial: "" }),
        size: new fields.StringField({ initial: "" }),
        languages: new fields.ArrayField(new fields.StringField(), { initial: [] }),
        xplog: new fields.ArrayField(new fields.ObjectField(), { initial: [] })
      }),
      
      // Combat
      combat: new fields.SchemaField({
        lastinit: new fields.NumberField({ ...requiredInteger, initial: 0 }),
        iscritical: new fields.BooleanField({ initial: false }),
        isfumble: new fields.BooleanField({ initial: false }),
        islegendary: new fields.BooleanField({ initial: false })
      }),
      
      // Character type
      chartype: new fields.StringField({ initial: "player" }),
      villainy: new fields.BooleanField({ initial: false }),
      
      // Bougette
      bougette: new fields.SchemaField({
        state: new fields.StringField({ initial: "nomoney" }),
        value: new fields.NumberField({ ...requiredInteger, initial: 0 })
      }),
      
      // XP
      xp: new fields.SchemaField({
        key: new fields.StringField({ initial: "xp" }),
        label: new fields.StringField({ initial: "BOL.traits.xp" }),
        total: new fields.NumberField({ ...requiredInteger, initial: 0 }),
        spent: new fields.NumberField({ ...requiredInteger, initial: 0 })
      }),
      
      // Creation
      creation: new fields.SchemaField({
        key: new fields.StringField({ initial: "creation" }),
        label: new fields.StringField({ initial: "BOL.resources.creation" }),
        value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
        max: new fields.NumberField({ ...requiredInteger, initial: 0 })
      }),
      
      // Protection
      prot: new fields.SchemaField({
        key: new fields.StringField({ initial: "prot" }),
        label: new fields.StringField({ initial: "BOL.aptitudes.prot" }),
        base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
        value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
        bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
      }),
      
      // Attributes
      attributes: new fields.SchemaField({
        vigor: new fields.SchemaField({
          key: new fields.StringField({ initial: "vigor" }),
          label: new fields.StringField({ initial: "BOL.attributes.vigor" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          min: new fields.NumberField({ ...requiredInteger, initial: -1 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 5 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        agility: new fields.SchemaField({
          key: new fields.StringField({ initial: "agility" }),
          label: new fields.StringField({ initial: "BOL.attributes.agility" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          min: new fields.NumberField({ ...requiredInteger, initial: -1 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 5 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        mind: new fields.SchemaField({
          key: new fields.StringField({ initial: "mind" }),
          label: new fields.StringField({ initial: "BOL.attributes.mind" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          min: new fields.NumberField({ ...requiredInteger, initial: -1 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 5 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        appeal: new fields.SchemaField({
          key: new fields.StringField({ initial: "appeal" }),
          label: new fields.StringField({ initial: "BOL.attributes.appeal" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        })
      }),
      
      // Aptitudes
      aptitudes: new fields.SchemaField({
        init: new fields.SchemaField({
          key: new fields.StringField({ initial: "init" }),
          label: new fields.StringField({ initial: "BOL.aptitudes.init" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        melee: new fields.SchemaField({
          key: new fields.StringField({ initial: "melee" }),
          label: new fields.StringField({ initial: "BOL.aptitudes.melee" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        ranged: new fields.SchemaField({
          key: new fields.StringField({ initial: "ranged" }),
          label: new fields.StringField({ initial: "BOL.aptitudes.ranged" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        def: new fields.SchemaField({
          key: new fields.StringField({ initial: "def" }),
          label: new fields.StringField({ initial: "BOL.aptitudes.def" }),
          base: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 })
        })
      }),
      
      // Resources
      resources: new fields.SchemaField({
        hp: new fields.SchemaField({
          key: new fields.StringField({ initial: "hp" }),
          label: new fields.StringField({ initial: "BOL.resources.hp" }),
          ismain: new fields.BooleanField({ initial: true }),
          base: new fields.NumberField({ ...requiredInteger, initial: 1 }),
          value: new fields.NumberField({ ...requiredInteger, initial: 1 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 1 })
        }),
        hero: new fields.SchemaField({
          key: new fields.StringField({ initial: "hero" }),
          label: new fields.StringField({ initial: "BOL.resources.hero" }),
          ismain: new fields.BooleanField({ initial: true }),
          value: new fields.NumberField({ ...requiredInteger, initial: 5 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 5 })
        }),
        faith: new fields.SchemaField({
          key: new fields.StringField({ initial: "faith" }),
          label: new fields.StringField({ initial: "BOL.resources.faith" }),
          ismain: new fields.BooleanField({ initial: true }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        power: new fields.SchemaField({
          key: new fields.StringField({ initial: "power" }),
          label: new fields.StringField({ initial: "BOL.resources.power" }),
          ismain: new fields.BooleanField({ initial: true }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        alchemypoints: new fields.SchemaField({
          key: new fields.StringField({ initial: "alchemypoints" }),
          label: new fields.StringField({ initial: "BOL.resources.alchemypoints" }),
          ismain: new fields.BooleanField({ initial: false }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 0 })
        }),
        astrologypoints: new fields.SchemaField({
          key: new fields.StringField({ initial: "astrologypoints" }),
          label: new fields.StringField({ initial: "BOL.resources.astrologypoints" }),
          ismain: new fields.BooleanField({ initial: false }),
          value: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          bonus: new fields.NumberField({ ...requiredInteger, initial: 0 }),
          max: new fields.NumberField({ ...requiredInteger, initial: 0 })
        })
      })
    };
  }

  static LOCALIZATION_PREFIXES = ["BOL.Character"];
}
