import SR6BaseActorData from '../base-actor-data.mjs';
import { monitorsSchema } from '../schema-helpers.mjs';

export default class SR6VehicleActorData extends SR6BaseActorData {
    static defineSchema() {
        const fields = foundry.data.fields;
        const vskill = () => new fields.SchemaField({
            points:   new fields.NumberField({ initial: 0 }),
            modifier: new fields.NumberField({ initial: 0 }),
            pool:     new fields.NumberField({ initial: 0 })
        });
        return {
            ...super.defineSchema(),
            handlOn:  new fields.NumberField({ initial: 1 }),
            handlOff: new fields.NumberField({ initial: 2 }),
            accOn:    new fields.NumberField({ initial: 3 }),
            accOff:   new fields.NumberField({ initial: 4 }),
            spdiOn:   new fields.NumberField({ initial: 5 }),
            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: "ground_craft" }),
            vehicle: new fields.SchemaField({
                belongs: new fields.StringField({ initial: "" }),
                opMode:  new fields.StringField({ initial: "manual" }),
                offRoad: new fields.BooleanField({ initial: false }),
                speed:   new fields.NumberField({ initial: 0 })
            }),
            ...monitorsSchema(),
            skills: new fields.SchemaField({
                piloting:   vskill(),
                evasion:    vskill(),
                perception: vskill(),
                cracking:   vskill(),
                stealth:    vskill()
            })
        };
    }
}
