import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
var ROW_DRAG_STATUS = 'rowDragStatus';
var RowDragApi = /*#__PURE__*/function () {
  function RowDragApi(pipeline) {
    _classCallCheck(this, RowDragApi);
    this.pipeline = pipeline;
    this.rowDropZoneParams = null;
    this.rowDropZones = [];
    this.dragStatus = 'finished';
  }
  return _createClass(RowDragApi, [{
    key: "getRowDropZoneParams",
    value: function getRowDropZoneParams() {
      return this.rowDropZoneParams;
    }
  }, {
    key: "setRowDropZoneParams",
    value: function setRowDropZoneParams(params) {
      this.rowDropZoneParams = params;
    }
  }, {
    key: "addRowDropZone",
    value: function addRowDropZone(rowDropZone) {
      if (!rowDropZone || !(rowDropZone === null || rowDropZone === void 0 ? void 0 : rowDropZone.getContainer())) {
        return;
      }
      var isExist = this.rowDropZones.some(function (zone) {
        return zone.getContainer() === rowDropZone.getContainer();
      });
      if (isExist) {
        return;
      }
      this.rowDropZones.push(rowDropZone);
    }
  }, {
    key: "getRowDropZone",
    value: function getRowDropZone() {
      return this.rowDropZones;
    }
  }, {
    key: "removeRowDropZone",
    value: function removeRowDropZone(rowDropZone) {
      var _context;
      this.rowDropZones = _filterInstanceProperty(_context = this.rowDropZones).call(_context, function (zone) {
        return zone.getContainer() !== rowDropZone.getContainer();
      });
    }
  }, {
    key: "setDragStatus",
    value: function setDragStatus(status) {
      var currentStatus = this.dragStatus;
      this.dragStatus = status;
      if (currentStatus !== status) {
        this.pipeline.setStateAtKey(ROW_DRAG_STATUS, status);
      }
    }
  }, {
    key: "getDragStatus",
    value: function getDragStatus() {
      return this.dragStatus;
    }
  }]);
}();
export { RowDragApi as default };