const Updater = require('./Updater');
const SplatNet = require('../splatnet');
const { getOriginalGear } = require('../../js/splatoon');

class MerchandisesUpdater extends Updater {
    constructor() {
        super({
            name: 'Merchandises',
            filename: 'merchandises.json',
            request: (splatnet) => splatnet.getMerchandises(),
            rootKeys: ['merchandises'],
            imagePaths: [
                '$..gear.image',
                '$..gear.brand.image',
                '$..gear.brand.frequent_skill.image',
                '$..skill.image',
            ],
        });
    }

    processData(data) {
        for (let merchandise of data.merchandises)
            merchandise.original_gear = getOriginalGear(merchandise.gear);

        return data;
    }
}

module.exports = MerchandisesUpdater;

const Updater = require('./Updater');
const SplatNet = require('../splatnet');
const { getOriginalGear } = require('../../js/splatoon');

class MerchandisesUpdater extends Updater {
    constructor() {
        super({
            name: 'Merchandises',
            filename: 'merchandises.json',
            request: (splatnet) => splatnet.getMerchandises(),
            rootKeys: ['merchandises'],
            imagePaths: [
                '$..gear.image',
                '$..gear.brand.image',
                '$..gear.brand.frequent_skill.image',
                '$..skill.image',
            ],
        });
    }

    processData(data) {
        for (let merchandise of data.merchandises) {
            let originalGear = getOriginalGear(merchandise.gear);

            // We don't need the brand data since it should match the SplatNet gear's brand
            if (originalGear)
                delete originalGear.brand

            merchandise.original_gear = originalGear;
        }

        return data;
    }
}

module.exports = MerchandisesUpdater;

Remove original_gear brand data from merchandises.json
Remove original_gear brand data from merchandises.json

This is a bit redundant and doesn't really add anything we don't already have.