module.exports = Self => {
    Self.remoteMethod('getRate2', {
        description: 'Return the rate2',
        accessType: 'READ',
        accepts: [
            {
                arg: 'fixedPriceId',
                type: 'integer',
                description: 'The fixedPrice Id',
                required: true
            },
            {
                arg: 'rate3',
                type: 'number',
                description: `The price rate 3`,
                required: true
            }
        ],
        returns: {
            type: 'object',
            root: true
        },
        http: {
            path: `/getRate2`,
            verb: 'GET'
        }
    });

    Self.getRate2 = async(fixedPriceId, rate3, options) => {
        const myOptions = {};

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

        const [result] = await Self.rawSql(`SELECT vn.priceFixed_getRate2(?, ?) as rate2`,
            [fixedPriceId, rate3], myOptions);
        return result;
    };
};