import SR6BaseItemData from '../base-item-data.mjs';

export default class SR6GearItemData extends SR6BaseItemData {
    static defineSchema() {
        const fields = foundry.data.fields;
        return {
            ...super.defineSchema(),
            // override base availDef "1L" default — gear template.json uses ""
            availDef:    new fields.StringField({ initial: "" }),
            type:        new fields.StringField({ initial: "WEAPON_FIREARMS" }),
            subtype:     new fields.StringField({ initial: "" }),
            count:       new fields.NumberField({ initial: 0 }),
            countable:   new fields.BooleanField({ initial: false }),
            avail:       new fields.NumberField({ initial: 0 }),
            ammocap:     new fields.NumberField({ initial: 0 }),
            ammocount:   new fields.NumberField({ initial: 0 }),
            ammoLoaded:  new fields.StringField({ initial: "regular" }),
            priceDef:    new fields.StringField({ initial: "" }),
            customName:  new fields.StringField({ initial: "" }),
            usedForPool: new fields.BooleanField({ initial: false }),
            notes:       new fields.HTMLField(),
            accessories: new fields.StringField({ initial: "" }),
            needsRating: new fields.BooleanField({ initial: false }),
            rating:      new fields.NumberField({ initial: 0 }),
            skill:       new fields.StringField({ initial: "" }),
            skillSpec:   new fields.StringField({ initial: "" }),
            dmg:         new fields.NumberField({ initial: 0 }),
            stun:        new fields.BooleanField({ initial: false }),
            dmgDef:      new fields.StringField({ initial: "" }),
            attackRating: new fields.ArrayField(new fields.NumberField({ initial: 0 })),
            modes: new fields.SchemaField({
                BF: new fields.BooleanField({ initial: false }),
                FA: new fields.BooleanField({ initial: false }),
                SA: new fields.BooleanField({ initial: false }),
                SS: new fields.BooleanField({ initial: false })
            }),
            defense:    new fields.NumberField({ initial: 0 }),
            social:     new fields.NumberField({ initial: 0 }),
            essence:    new fields.NumberField({ initial: 0 }),
            capacity:   new fields.NumberField({ initial: 0 }),
            natural:    new fields.BooleanField({ initial: false }),
            devRating:  new fields.NumberField({ initial: 0 }),
            a:          new fields.NumberField({ initial: 0 }),
            s:          new fields.NumberField({ initial: 0 }),
            d:          new fields.NumberField({ initial: 0 }),
            f:          new fields.NumberField({ initial: 0 }),
            progSlots:  new fields.NumberField({ initial: 0 }),
            handlOn:    new fields.NumberField({ initial: 0 }),
            handlOff:   new fields.NumberField({ initial: 0 }),
            accOn:      new fields.NumberField({ initial: 0 }),
            accOff:     new fields.NumberField({ initial: 0 }),
            spdiOn:     new fields.NumberField({ initial: 0 }),
            spdiOff:    new fields.NumberField({ initial: 0 }),
            tspd:       new fields.NumberField({ initial: 0 }),
            bod:        new fields.NumberField({ initial: 0 }),
            arm:        new fields.NumberField({ initial: 0 }),
            pil:        new fields.NumberField({ initial: 0 }),
            sen:        new fields.NumberField({ initial: 0 }),
            sea:        new fields.NumberField({ initial: 0 }),
            vtype:      new fields.StringField({ initial: "" }),
            vehicle: new fields.SchemaField({
                opMode: new fields.StringField({ initial: "manual" })
            }),
            strWeapon: new fields.BooleanField({ initial: false }),
            dualHand:  new fields.BooleanField({ initial: false })
        };
    }
}
