import { SYSTEM } from "../config/system.mjs"

export default class AwESpecialization extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    const fields = foundry.data.fields
    const schema = {}

    schema.fieldName = new fields.StringField({
      required: true,
      nullable: false,
      initial: "",
      blank: true
    })

    schema.keyAttributeOverride = new fields.StringField({
      required: false,
      nullable: true,
      initial: "",
      blank: true,
      choices: {
        "": "—",
        ...Object.fromEntries(Object.values(SYSTEM.ATTRIBUTES).map(a => [a.id, a.label]))
      }
    })

    schema.description = new fields.HTMLField({ required: true, textSearch: true })
    schema.traits = new fields.ArrayField(new fields.StringField())

    return schema
  }
}
