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

Easydb4MigrationPlugin.BurgHalle = (function(superClass) {
  extend(BurgHalle, superClass);

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

  BurgHalle.prototype.name = function() {
    return "burg-halle";
  };

  BurgHalle.prototype.payload = function(filename, json, update, store_file) {
    var i, len, obj, ref;
    if (json.import_type === "tags") {
      json.tags.push({
        taggroup: {
          reference: "easydb4:person_kustodie",
          type: "checkbox",
          displayname: {
            "de-DE": "Sichtbarkeit"
          }
        },
        _tags: [
          {
            tag: {
              shortname: "name_verbergen",
              displayname: {
                "de-DE": "Name verbergen"
              },
              is_default: false,
              enabled: true,
              displaytype: "search",
              type: "individual"
            }
          }
        ]
      });
      return;
    }
    if (json.objecttype === "person_kustodie") {
      ref = json.objects;
      for (i = 0, len = ref.length; i < len; i++) {
        obj = ref[i];
        if (!obj.person_kustodie.namen_verbergen) {
          continue;
        }
        obj._tags = [
          {
            "lookup:_id": {
              shortname: "name_verbergen"
            }
          }
        ];
      }
    }
    if (json.objecttype === "mat_attribute") {
      return this.splitByType(filename, json, update, store_file, "mat_attribute", "typus");
    }
  };

  return BurgHalle;

})(Easydb4MigrationPlugin);

ez5.session_ready((function(_this) {
  return function() {
    return Easydb4Migration.plugins.registerPlugin(Easydb4MigrationPlugin.BurgHalle);
  };
})(this));
