"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.propsForBankEntryUnauthorizedEdit = exports.propsForStimulusBankEntryEditPrompt = exports.propsForItemBankEntryEditPrompt = exports.propsForBankEntryEditPrompt = exports.propsForBankEntryVersioningWrapper = exports.propsForStimulusVersioningWrapper = exports.propsForItemVersioningWrapper = void 0;

var _react = _interopRequireDefault(require("react"));

var _partial = _interopRequireDefault(require("lodash/partial"));

var _Text = _interopRequireDefault(require("@instructure/ui-elements/lib/components/Text"));

var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/lib/format-message"));

var immutableItemDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Vissa elever har redan l\xE4mnat in svar p\xE5 detta f\xF6rem\xE5l!"), "\xA0", "Du kan ange dina \xE4ndringar till en kopia av det h\xE4r f\xF6rem\xE5let, vilket endast kommer att ses av elever som inte har utsatts f\xF6r bed\xF6mningen.");

var itemCopyDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Redigera en kopia"), "\xA0", "F\xF6rem\xE5lsstatistik fr\xE5n den h\xE4r nya kopian visas separat fr\xE5n den tidigare versionen av den h\xE4r fr\xE5gan.");

var immutableStimulusDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Vissa elever har redan l\xE4mnat in svar p\xE5 denna stimulans!"), "\xA0", "Du kan ange dina \xE4ndringar till en kopia av denna stimulans som endast kommer att ses av elever som inte har utsatts f\xF6r bed\xF6mningen. Bifogade f\xF6rem\xE5l kopieras ocks\xE5.");

var stimulusCopyDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Redigera en kopia"), "\xA0", "Statistik f\xF6r stmulans fr\xE5n den h\xE4r nya kopian visas separat fr\xE5n den tidigare versionen.");

var itemBankEntryEditDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Bankade f\xF6rem\xE5l."), "\xA0", "Vissa alternativ och po\xE4ngv\xE4rden kan \xE4ndras h\xE4r, men redigeringen m\xE5ste ske inom banken.");

var stimulusBankEntryEditDescription = _react.default.createElement(_Text.default, {
  "data-automation": "sdk-editInBanks-warning"
}, _react.default.createElement("b", null, "Bankad stimulus"), "\xA0", "Redigering av denna stimulans m\xE5ste ske inom banken.");

var bankEntryUnauthorizedEditDescription = _react.default.createElement(_Text.default, null, _react.default.createElement("b", null, "Bankade f\xF6rem\xE5l."), "\xA0", "Du \xE4r inte beh\xF6rig att redigera det h\xE4r f\xF6rem\xE5let.");

var archivedBankEntryDescription = _react.default.createElement(_Text.default, null, "Det h\xE4r objektet har tagits bort fr\xE5n artikelbanken. Eleverna ser det fortfarande vid framtida f\xF6rs\xF6k. F\xF6r att redigera, g\xF6r en kopia av objektet.");

var propsForVersioningWrapper = function propsForVersioningWrapper(copyDescription, immutableDescription, isImmutable, shouldClone, setShouldClone, switchOffEditing, isEditing) {
  var alertType = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : 'warning';
  var defaultProps = {
    disableChildren: false,
    showAlert: false
  };
  if (!isEditing) return {
    showAlert: false
  };

  if (isImmutable && shouldClone) {
    Object.assign(defaultProps, {
      description: copyDescription,
      hideActions: true,
      showAlert: true
    });
  } else if (isImmutable) {
    Object.assign(defaultProps, {
      alertType: alertType,
      cancelActionCallback: switchOffEditing,
      defaultActionCallback: (0, _partial.default)(setShouldClone, true),
      defaultActionText: "Redigera en kopia",
      description: immutableDescription,
      disableChildren: true,
      showAlert: true
    });
  }

  return defaultProps;
};

var propsForItemVersioningWrapper = function propsForItemVersioningWrapper() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }

  return propsForVersioningWrapper.apply(void 0, [itemCopyDescription, immutableItemDescription].concat(args));
};

exports.propsForItemVersioningWrapper = propsForItemVersioningWrapper;

var propsForStimulusVersioningWrapper = function propsForStimulusVersioningWrapper() {
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
    args[_key2] = arguments[_key2];
  }

  return propsForVersioningWrapper.apply(void 0, [stimulusCopyDescription, immutableStimulusDescription].concat(args));
};

exports.propsForStimulusVersioningWrapper = propsForStimulusVersioningWrapper;

var propsForBankEntryVersioningWrapper = function propsForBankEntryVersioningWrapper() {
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
    args[_key3] = arguments[_key3];
  }

  return propsForVersioningWrapper.apply(void 0, [itemCopyDescription, archivedBankEntryDescription].concat(args));
};

exports.propsForBankEntryVersioningWrapper = propsForBankEntryVersioningWrapper;

var propsForBankEntryEditPrompt = function propsForBankEntryEditPrompt(isEditing, switchOffEditing, defaultActionCallback, description) {
  if (!isEditing) return {
    showAlert: false
  };
  return {
    cancelActionCallback: switchOffEditing,
    disableChildren: true,
    description: description,
    defaultActionCallback: defaultActionCallback,
    defaultActionText: "Redigera i bank",
    showAlert: true
  };
};

exports.propsForBankEntryEditPrompt = propsForBankEntryEditPrompt;

var propsForItemBankEntryEditPrompt = function propsForItemBankEntryEditPrompt() {
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
    args[_key4] = arguments[_key4];
  }

  return propsForBankEntryEditPrompt.apply(void 0, args.concat([itemBankEntryEditDescription]));
};

exports.propsForItemBankEntryEditPrompt = propsForItemBankEntryEditPrompt;

var propsForStimulusBankEntryEditPrompt = function propsForStimulusBankEntryEditPrompt() {
  for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
    args[_key5] = arguments[_key5];
  }

  return propsForBankEntryEditPrompt.apply(void 0, args.concat([stimulusBankEntryEditDescription]));
};

exports.propsForStimulusBankEntryEditPrompt = propsForStimulusBankEntryEditPrompt;

var propsForBankEntryUnauthorizedEdit = function propsForBankEntryUnauthorizedEdit(isEditing) {
  if (!isEditing) return {
    showAlert: false
  };
  return {
    alertType: 'warning',
    disableChildren: true,
    description: bankEntryUnauthorizedEditDescription,
    hideActions: true,
    showAlert: true
  };
};

exports.propsForBankEntryUnauthorizedEdit = propsForBankEntryUnauthorizedEdit;