import BaseItem from "./baseItem.mjs";

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

export class EquipmentDataModel extends BaseItem {

    static defineSchema() {
        return {
            quantity: new NumberField({required: true, integer: true, initial: 1}),
            category: new ArrayField(new StringField({required: true})),
            description: new HTMLField(),
            weight: new NumberField({required: true}),
            price: new StringField(),

            breakFactor: new NumberField({required: false}),
            iniModifier: new NumberField({required: false}),
            attackModifier: new NumberField({required: false}),
            parryModifier: new NumberField({required: false}),

            meleeAttackModifier: new NumberField({integer: true}),
            meleeAttackModifierIncrement: new NumberField({integer: true}),
            meleeSkills: new ArrayField(
                new StringField({required: true}),
            ),
            meleeAttackDamage: new StringField(),

            rangedSkills: new ArrayField(
                new StringField({required: true}),
            ),
            rangedRangeModifier: new StringField({required: false}),
            rangeRangeDamageModifier: new StringField({required: false}),
            rangedAttackDamage: new StringField(),
            rangedReloadTime: new NumberField({required: false}),

            armorValue: new SchemaField({
                total: new NumberField({required: true, initial: 0}),
                armlinks: new NumberField({required: true, initial: 0}),
                beinlinks: new NumberField({required: true, initial: 0}),
                armrechts: new NumberField({required: true, initial: 0}),
                beinrechts: new NumberField({required: true, initial: 0}),
                ruecken: new NumberField({required: true, initial: 0}),
                bauch: new NumberField({required: true, initial: 0}),
                brust: new NumberField({required: true, initial: 0}),
                kopf: new NumberField({required: true, initial: 0}),
            }, {required: false}),
            armorHandicap: new NumberField({required: false}),

            ammunition: new SchemaField({
                max: new NumberField({required: true, initial: 1}),
                count: new NumberField({required: true, initial: 1}),
            }, {required: false}),

            currencyName: new StringField({required: false}),
            currencyDenominator: new NumberField({required: false}),
        }
    }


}
