{"size": 1590, "ext": "js", "max_stars_repo_path": "app/js/dao.js", "max_stars_repo_name": "communityus/ka-web", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/js/dao.js", "max_issues_repo_name": "communityus/ka-web", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/js/dao.js", "max_forks_repo_name": "communityus/ka-web", "max_forks_repo_forks_event_min_datetime": "2019-08-22T02:20:37.000Z", "max_forks_repo_forks_event_max_datetime": "2020-03-09T11:29:06.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 25.6451612903, "max_line_length": 72, "alphanum_fraction": 0.5320754717}
'use strict';

var server = require('js/server');
var _ = require('lodash');

// TODO Can we replace this with a function to recursively require them?

require('js/dao/stats');
require('js/dao/empire');
require('js/dao/captcha');
require('js/dao/essentiaVein');
require('js/dao/intelTraining');
require('js/dao/mayhemTraining');
require('js/dao/politicsTraining');
require('js/dao/theftTraining');
require('js/dao/genericBuilding');
require('js/dao/shipyard');
require('js/dao/spacePort');
require('js/dao/trade');
require('js/dao/transporter');
require('js/dao/map');
require('js/dao/body');
require('js/dao/ws');

require('js/ws');

module.exports.makeServerCall = function(uri, options, actions) {
    var defaults = {
        module: uri,
        params: {},
        success: 'noop',
        error: 'noop',
    };
    options = _.merge({}, defaults, options || {});

    server.call({
        module: options.module,
        method: options.method,
        params: options.params,
        success: function(result) {
            console.log(
                'makeServerCall: SUCCESS ' +
                    uri +
                    ' - ' +
                    options.method +
                    '_success'
            );
            actions[options.success](result);
        },
        error: function(error) {
            console.log(
                'makeServerCall: FAILURE ' +
                    uri +
                    ' - ' +
                    options.method +
                    '_success'
            );
            actions[options.error](error);
        },
    });
};
