// Generated by CoffeeScript 1.10.0
(function() {
  var _, createSimulationManager;

  _ = require('lodash');

  createSimulationManager = function(app) {
    var all, create, get, list;
    create = function() {
      var id;
      while (true) {
        id = Math.random().toString(16).substring(2);
        if (app.config.simulations[id] == null) {
          break;
        }
      }
      app.config.simulations[id] = {
        title: 'New simulation',
        tasks: [],
        createdAt: +new Date()
      };
      return id;
    };
    get = function(id) {
      return app.config.simulations[id];
    };
    list = function() {
      return _.keys(app.config.simulations);
    };
    all = function() {
      return app.config.simulations;
    };
    return {
      create: create,
      get: get,
      list: list,
      all: all
    };
  };

  module.exports = createSimulationManager;

}).call(this);
