// Generated by CoffeeScript 1.9.1
(function() {
  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  define(function() {
    var Skeleton;
    return Skeleton = (function() {
      function Skeleton(path1) {
        this.path = path1;
        this.postEmpty = bind(this.postEmpty, this);
        this.postFacet = bind(this.postFacet, this);
        this.applyCommand = bind(this.applyCommand, this);
        this.getBOCall = bind(this.getBOCall, this);
      }


      /*
       *   Studiogdo API
       */

      Skeleton.prototype.getBOCall = function(params, rootAddress) {
        var bocall, k, v;
        if (params == null) {
          params = {};
        }
        if (rootAddress == null) {
          rootAddress = null;
        }
        bocall = new BOCall({
          "rootAddress": rootAddress
        });
        for (k in params) {
          v = params[k];
          bocall.appendBOParam(k, v);
        }
        return bocall;
      };

      Skeleton.prototype.applyCommand = function(callback, path, cmd, params) {
        var bocall;
        if (params == null) {
          params = {};
        }
        bocall = this.getBOCall(params);
        bocall.done = (function(_this) {
          return function() {
            return callback();
          };
        })(this);
        return bocall.applyCommand(path, cmd);
      };

      Skeleton.prototype.postFacet = function(callback, path, skel, params) {
        var bocall;
        if (params == null) {
          params = {};
        }
        bocall = this.getBOCall(params);
        bocall.done = (function(_this) {
          return function() {
            return callback(bocall);
          };
        })(this);
        return bocall.postFacet(path, skel, 'django');
      };

      Skeleton.prototype.postEmpty = function(callback, params) {
        var bocall;
        if (params == null) {
          params = {};
        }
        bocall = this.getBOCall(params);
        bocall.done = (function(_this) {
          return function() {
            if (callback) {
              return callback();
            } else {
              return null;
            }
          };
        })(this);
        return bocall.postEmpty();
      };

      return Skeleton;

    })();
  });

}).call(this);
