"use strict";

exports.__esModule = true;
exports.getBulkAssignStatus = getBulkAssignStatus;
exports.getDisabledTooltipContent = getDisabledTooltipContent;
function getBulkAssignStatus({
  state
}) {
  var _state$tagsCollection, _state$tagsCollection2, _state$tagsCollection3;
  const canUseBulkSync = (_state$tagsCollection = state.tagsCollectionState) == null ? void 0 : _state$tagsCollection.tagsBulkAssignPopoverState.bulkAssignSyncState.canUseBulkSync;
  const canBulkAssignAsync = (_state$tagsCollection2 = state.tagsCollectionState) == null ? void 0 : _state$tagsCollection2.tagsBulkAssignPopoverState.bulkAssignAsyncState.canBulkAssignAsync;
  const hasReachedMaxSelectedItems = !canUseBulkSync && !canBulkAssignAsync;
  const isDuringApplyChanges = (_state$tagsCollection3 = state.tagsCollectionState) == null ? void 0 : _state$tagsCollection3.tagsBulkAssignPopoverState.bulkAssignAsyncState.isDuringApplyChanges;
  return {
    hasReachedMaxSelectedItems,
    isDuringApplyChanges
  };
}
function getDisabledTooltipContent({
  state,
  hasSelectedFolders
}) {
  var _state$tagsCollection4;
  const {
    hasReachedMaxSelectedItems,
    isDuringApplyChanges
  } = getBulkAssignStatus({
    state
  });
  const assignButtonConfig = state == null || (_state$tagsCollection4 = state.tagsCollectionState) == null ? void 0 : _state$tagsCollection4.tagsBulkAssignPopoverState.assignButtonConfig;
  const assignButtomTooltip = assignButtonConfig != null && assignButtonConfig.isDisabled ? assignButtonConfig.tooltipContent : null;
  switch (true) {
    case isDuringApplyChanges:
      return state.container.translate('cairo.tags.popover.bulkItemUpdate.tooltip');
    case hasSelectedFolders:
      return state.container.translate('cairo.tags.popover.assignFolder.tooltip');
    case hasReachedMaxSelectedItems:
      return state.container.translate('cairo.tags.popover.bulkItemLimit.tooltip');
    case assignButtonConfig == null ? void 0 : assignButtonConfig.isDisabled:
      return assignButtomTooltip;
    default:
      return null;
  }
}
//# sourceMappingURL=TagsBulkAssignUtils.js.map