import { BaseItemDataModel } from "./base-item.mjs"

export default class MetierDataModel extends BaseItemDataModel {
  static defineSchema() {
    const fields = foundry.data.fields
    return {
      ...this.defineBaseSchema(),
      specialRules: new fields.HTMLField({ initial: "" }),
      roleplayNotes: new fields.HTMLField({ initial: "" }),
      skillBonuses: new fields.ArrayField(new fields.SchemaField({
        key: new fields.StringField({ initial: "" }),
        alternativeKeys: new fields.ArrayField(new fields.StringField(), { initial: [] }),
        base: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
        domainsGranted: new fields.ArrayField(new fields.StringField(), { initial: [] }),
        domainsToChoose: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
        domainsChoiceText: new fields.StringField({ initial: "" }),
      }), { initial: [] }),
      startingEquipment: new fields.ArrayField(new fields.SchemaField({
        name: new fields.StringField({ initial: "" }),
        type: new fields.StringField({ initial: "equipement" }),
        quantity: new fields.NumberField({ initial: 1, integer: true, min: 0 }),
        details: new fields.StringField({ initial: "" }),
        choiceText: new fields.StringField({ initial: "" }),
        ecorces: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
      }), { initial: [] }),
      spellGrants: new fields.ArrayField(new fields.SchemaField({
        tradition: new fields.StringField({ initial: "" }),
        skillKey: new fields.StringField({ initial: "" }),
        polarity: new fields.StringField({ initial: "" }),
        amount: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
      }), { initial: [] }),
      revenues: new fields.SchemaField({
        beginner: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
        intermediate: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
        expert: new fields.NumberField({ initial: 0, integer: true, min: 0 }),
      }),
    }
  }
}
