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;

@@ -685,16 +685,18 @@
 andises)
+ %7B
 %0A       
@@ -704,28 +704,179 @@
     
-merchandise.
+let originalGear = getOriginalGear(merchandise.gear);%0A%0A            // We don't need the brand data since it should match the SplatNet gear's brand%0A            if (
 original
 _gea
@@ -875,50 +875,120 @@
 inal
-_gear = getOriginalGear(merchandise.gear);
+Gear)%0A                delete originalGear.brand%0A%0A            merchandise.original_gear = originalGear;%0A        %7D
 %0A%0A  

Remove original_gear brand data from merchandises.json