// Generated by CoffeeScript 1.12.7
var BaseMigrationNodeTransitions,
  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;

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

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

  BaseMigrationNodeTransitions.prototype.getDisplayText = function() {
    return "Workflows";
  };

  BaseMigrationNodeTransitions.prototype.getActionFields = function() {
    return [
      {
        type: CUI.Options,
        name: "mode",
        radio: true,
        form: {
          label: $$("base.migration.common.options")
        },
        options: [
          {
            text: $$("base.migration.common.replace"),
            value: "replace"
          }, {
            text: $$("base.migration.common.add"),
            value: "add"
          }
        ]
      }
    ];
  };

  BaseMigrationNodeTransitions.prototype.migrate = function(ev, action_data) {
    var c, copied_transition, i, len, migration, ref, target;
    migration = this.getMigration();
    if (action_data === "replace") {
      target = [];
    } else {
      target = CUI.util.copyObject(migration.getBaseData().transitions, true);
    }
    ref = this.children;
    for (i = 0, len = ref.length; i < len; i++) {
      c = ref[i];
      copied_transition = migration.migrateTransition(c.getData());
      if (copied_transition) {
        target.push(copied_transition);
      }
    }
    if (ev.hasModifierKey()) {
      console.debug("migrate Transitions:", CUI.util.dump(target), target);
      return CUI.resolvedPromise();
    }
    return BaseMigrationNodeTransition.prototype.saveTransitions.call(this, target);
  };

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

  return BaseMigrationNodeTransitions;

})(BaseMigrationNodeObjecttypes);
