{"size": 1219, "ext": "js", "max_stars_repo_path": "test/fixtures/barChartDataBuilder.js", "max_stars_repo_name": "crisscrossed/britecharts", "max_stars_repo_stars_event_min_datetime": "2018-08-27T20:44:33.000Z", "max_stars_repo_stars_event_max_datetime": "2018-08-27T20:44:33.000Z", "max_issues_repo_path": "test/fixtures/barChartDataBuilder.js", "max_issues_repo_name": "crisscrossed/britecharts", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/fixtures/barChartDataBuilder.js", "max_forks_repo_name": "crisscrossed/britecharts", "max_forks_repo_forks_event_min_datetime": "2020-01-27T14:36:39.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-27T14:36:39.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 24.8775510204, "max_line_length": 68, "alphanum_fraction": 0.5438884331}
define(function(require) {
    'use strict';

    var _ = require('underscore'),

        jsonColors = require('json!../json/barColors.json'),
        jsonLetters = require('json!../json/barDataLetters.json');


    function BarDataBuilder(config){
        this.Klass = BarDataBuilder;

        this.config = _.defaults({}, config);

        this.withLettersFrequency = function(){
            var attributes = _.extend({}, this.config, jsonLetters);

            return new this.Klass(attributes);
        };

        this.withColors = function(){
            var attributes = _.extend({}, this.config, jsonColors);

            return new this.Klass(attributes);
        };

        /**
         * Sets the path for fetching the data
         * @param  {String} path Desired path for test data
         * @return {BarDataBuilder}      Builder object
         */
        this.withPath = function(path){
            var attributes = _.extend({}, this.config, {
                jsonURL: path
            });

            return new this.Klass(attributes);
        };

        this.build = function() {
            return this.config.data;
        };
    }

    return {
        BarDataBuilder: BarDataBuilder
    };
});
