// Generated by CoffeeScript 1.3.3
var __hasProp = {}.hasOwnProperty,
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

define(['underscore', 'serrano'], function(_, Serrano) {
  var DataContextHistory, DataContexts, contexts, history;
  DataContexts = (function(_super) {

    __extends(DataContexts, _super);

    function DataContexts() {
      return DataContexts.__super__.constructor.apply(this, arguments);
    }

    DataContexts.prototype.url = App.urls.datacontexts;

    return DataContexts;

  })(Serrano.DataContexts);
  DataContextHistory = (function(_super) {

    __extends(DataContextHistory, _super);

    function DataContextHistory() {
      return DataContextHistory.__super__.constructor.apply(this, arguments);
    }

    DataContextHistory.prototype.url = App.urls.datacontextHistory;

    return DataContextHistory;

  })(Serrano.DataContexts);
  contexts = new DataContexts;
  contexts.on('reset', function() {
    var defaults;
    if (!contexts.hasSession()) {
      defaults = {
        session: true
      };
      defaults.json = App.defaults.datacontext;
      return contexts.create(defaults);
    }
  });
  history = new DataContextHistory;
  contexts.fetch();
  return history.fetch();
});
