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

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

    let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern"
    schema.minimumEra = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS })

    schema.creationDate = new fields.StringField({
      required: true,
      initial: "",
      textSearch: true
    });

    // Language field
    schema.language = new fields.StringField({
      required: true,
      initial: "Latin",
      textSearch: true
    });

    // studyTime field
    schema.studyTime = new fields.StringField({
      required: true,
      initial: "X days",
      textSearch: true
    });

    // SAN loss field
    schema.sanLoss = new fields.StringField({
      required: true,
      initial: "1d4",
      textSearch: true
    });

    // Unnatural skill field
    schema.unnaturalSkill = new fields.StringField({
      required: true,
      initial: "1d4",
      textSearch: true
    });

    schema.rituals = new fields.StringField({
      required: true,
      initial: "",
      textSearch: true
    });

    schema.otherBenefits = new fields.StringField({
      required: true,
      initial: "",
      textSearch: true
    });

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

    return schema;
  }

  /** @override */
  static LOCALIZATION_PREFIXES = ["CTHULHUETERNAL.Tome"];
}