module.exports = Self => {
    Self.remoteMethod('getInventory', {
        description: 'Get list of itemShelving to review between two parking code',
        accessType: 'WRITE',
        accepts: [{
            arg: 'parkingFrom',
            type: 'string',
            required: true,
            description: 'Parking code from'
        },
        {
            arg: 'parkingTo',
            type: 'string',
            required: true,
            description: 'Parking code to'
        }],
        returns: {
            type: ['object'],
            root: true
        },
        http: {
            path: `/getInventory`,
            verb: 'POST'
        }
    });

    Self.getInventory = async(parkingFrom, parkingTo, options) => {
        const myOptions = {};

        if (typeof options == 'object')
            Object.assign(myOptions, options);

        const [result] = await Self.rawSql(`CALL vn.itemShelving_inventory(?, ?)`, [parkingFrom, parkingTo], myOptions);

        return result;
    };
};