import { TEMPLATE_DESCRIPTION } from "../common/_module.mjs";
import { INTEGER, STRING } from "../common/field-types.mjs";

const fields = foundry.data.fields;

export default class RdDModelSouffle extends foundry.abstract.TypeDataModel {
  static defineSchema() {
    return Object.assign({},
      TEMPLATE_DESCRIPTION.fields(),
      {
        duree: new fields.StringField({ label: "Durée", initial: "", ...STRING }),
        restant: new fields.NumberField({ label: "Restant", initial: 0, ...INTEGER }),
        hautrevant: new fields.BooleanField({ label: "Pour haut-rêvants", initial: false }),
        frequence: new fields.NumberField({ label: "Fréquence", initial: 0, ...INTEGER }),
        temporel: new fields.SchemaField({
          debut: new fields.SchemaField({
            indexDate: new fields.NumberField({ initial: -1, integer: true }),
            indexMinute: new fields.NumberField({ initial: 0, integer: true }),
          }),
          fin: new fields.SchemaField({
            indexDate: new fields.NumberField({ initial: -1, integer: true }),
            indexMinute: new fields.NumberField({ initial: 0, integer: true }),
          }),
        }),
      }
    );
  }
}
