// Generated by CoffeeScript 1.12.7
var BaseMigrationNodeGroupType,
  extend = 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; },
  hasProp = {}.hasOwnProperty;

BaseMigrationNodeGroupType = (function(superClass) {
  extend(BaseMigrationNodeGroupType, superClass);

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

  BaseMigrationNodeGroupType.prototype.initOpts = function() {
    BaseMigrationNodeGroupType.__super__.initOpts.call(this);
    return this.addOpts({
      type: {
        mandatory: true,
        check: ["system", "easydb"]
      }
    });
  };

  BaseMigrationNodeGroupType.prototype.getActionPane = function() {
    var pane;
    pane = this.getActionPaneBase();
    return pane;
  };

  BaseMigrationNodeGroupType.prototype.getDisplayText = function() {
    return this._type;
  };

  BaseMigrationNodeGroupType.prototype.checkMigrateButton = function() {
    return this.__migrateBtn.enable();
  };

  BaseMigrationNodeGroupType.prototype.getActionFields = function() {
    var fields;
    fields = BaseMigrationNodeGroup.prototype.getActionFields.call(this);
    if (this._type === "system") {
      fields.splice(2, 1);
    }
    return fields;
  };

  BaseMigrationNodeGroupType.prototype.migrate = function(ev, action_data) {
    var new_groups;
    new_groups = this.migrateGroups(action_data);
    if (ev.hasModifierKey()) {
      console.debug("migrate Groups:", CUI.util.dump(new_groups), new_groups);
      return CUI.resolvedPromise();
    }
    return BaseMigrationNodeGroup.prototype.saveGroups.call(this, new_groups).done((function(_this) {
      return function() {
        return _this.log($$("base.migration.console.log.group.type.migrated.md", {
          count: new_groups.length,
          type: _this._type
        }));
      };
    })(this));
  };

  BaseMigrationNodeGroupType.prototype.migrateGroups = function(action_data) {
    var c, i, len, new_group, new_groups, ref;
    new_groups = [];
    ref = this.children;
    for (i = 0, len = ref.length; i < len; i++) {
      c = ref[i];
      new_group = c.migrateGroup(action_data);
      new_groups.push(new_group);
    }
    return new_groups;
  };

  return BaseMigrationNodeGroupType;

})(BaseMigrationNodeData);
