import BaseItem from "./baseItem.mjs";

const {
    SchemaField,
    BooleanField,
    NumberField, 
    ArrayField, 
    StringField,
    HTMLField,
    ObjectField,
} = foundry.data.fields;

export class SpellDataModel extends BaseItem {

    static defineSchema() {
        return {
            seite: new NumberField(),
            zfw: new NumberField({initial: 0}),
            name: new StringField({required: true}),
            probe: new ArrayField(new StringField(), {required: true, exact: 3}),
            probeMod: new StringField(),
            hauszauber: new BooleanField(),
            technik: new StringField(),
            zauberdauer: new SchemaField({
                min: new StringField(),
                normal: new StringField(),
                additionalFormula: new StringField(),
                variables: new ArrayField(new StringField()),
                additionalFormulaTimeUnit: new StringField(),
            }),
            wirkung: new HTMLField(),
            kosten: new ArrayField(
                new SchemaField({
                    min: new StringField(),
                    cost: new StringField(),
                    additionalFormula: new StringField(),
                    variables: new ArrayField(new StringField()),
                    repräsentation: new StringField(),
                    complex: new StringField(),
                })
            ),
            zielobjekt: new StringField(),
            reichweite: new StringField({required: true}),
            wirkungsdauer: new StringField({required: true}),
            modifikationen: new StringField({required: true}),
            reversalis: new StringField(),
            antimagie: new StringField(),
            merkmal: new StringField(),
            komplexität: new StringField(),
            repräsentation: new ObjectField(),
            info: new StringField(),
            varianten: new ArrayField(new SchemaField({
                name: new StringField(),
                description: new HTMLField(),
                mod: new StringField(),
                limit: new NumberField(),
            }))

        }
    }

    /**
     * Augment the basic Item data model with additional dynamic data.
     */
    prepareData() {
    }

    /**
     * Prepare a data object which is passed to any Roll formulas which are created related to this Item
     * @private
     */
    getRollData() {
    }

    /**
     * Handle clickable rolls.
     * @param {Event} event   The originating click event
     * @private
     */
    async roll() {
    }

}
