/**
 * Created by CSL on 2017-03-23.
 */

var stdFeeRateLibs = require('../../std_fee_rate_libs/models/std_fee_rate_libs');
var projectFeeRateFile = require('../models/fee_rates');

module.exports = {
    libNames: function (req, res) {
        var region = req.body.region;
        stdFeeRateLibs.libNames(region, function (doc) {
            res.json({data: doc});
        });
    },

    libFeeRates: function (req, res) {
        var libID = req.body.libID;
        stdFeeRateLibs.rates(libID, function (doc) {
            res.json({data: doc});
        })
    },

    projectFeeRates: function (req, res) {
        var fileID = req.body.fileID;
        projectFeeRateFile.rates(fileID, function (doc) {
            res.json({data: doc});
        })
    },

    projectFeeUpdateRate: function (req, res) {
        var rateObj = {"fileID": req.body.fileID, "rateID": req.body.rateID, "rateValue": req.body.rateValue};
        projectFeeRateFile.updateRate(rateObj, function (doc) {
            res.json({data: doc});
        })
    }
}






