'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _partial = require('lodash/partial');

var _partial2 = _interopRequireDefault(_partial);

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

var _Text2 = _interopRequireDefault(_Text);

var _formatMessage = require('@instructure/quiz-common/lib/format-message');

var _formatMessage2 = _interopRequireDefault(_formatMessage);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var immutableItemDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    'Alguns alunos j\xE1 enviaram respostas para este item!'
  ),
  '\xA0',
  'Voc\xEA pode aplicar as suas edi\xE7\xF5es a uma c\xF3pia deste item que ser\xE3o vistas apenas pelos alunos que n\xE3o realizaram a avalia\xE7\xE3o.'
);

var itemCopyDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    'Editando uma c\xF3pia.'
  ),
  '\xA0',
  'As estat\xEDsticas do item desta c\xF3pia nova aparecer\xE3o separadamente da vers\xE3o pr\xE9via desta pergunta.'
);

var immutableStimulusDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    'Alguns alunos j\xE1 enviaram respostas para este est\xEDmulo!'
  ),
  '\xA0',
  'Voc\xEA pode aplicar as suas edi\xE7\xF5es a uma c\xF3pia deste est\xEDmulo que ser\xE3o vistas apenas pelos alunos que n\xE3o realizaram a avalia\xE7\xE3o. Itens anexados tamb\xE9m ser\xE3o copiados.'
);

var stimulusCopyDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    'Editando uma c\xF3pia.'
  ),
  '\xA0',
  'As estat\xEDsticas do est\xEDmulo desta c\xF3pia nova aparecer\xE3o separadamente da vers\xE3o pr\xE9via.'
);

var itemBankEntryEditDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    'Item armazenado.'
  ),
  '\xA0',
  'Algumas op\xE7\xF5es e valores de pontos podem ser alterados aqui, mas edi\xE7\xE3o deve ocorrer dentro do banco.'
);

var stimulusBankEntryEditDescription = _react2.default.createElement(
  _Text2.default,
  { 'data-automation': 'sdk-editInBanks-warning' },
  _react2.default.createElement(
    'b',
    null,
    'Est\xEDmulo armazenado.'
  ),
  '\xA0',
  'A edi\xE7\xE3o deste est\xEDmulo deve ocorrer dentro do banco.'
);

var bankEntryUnauthorizedEditDescription = _react2.default.createElement(
  _Text2.default,
  null,
  _react2.default.createElement(
    'b',
    null,
    'Item armazenado.'
  ),
  '\xA0',
  'Voc\xEA n\xE3o est\xE1 autorizado a editar este item.'
);

var archivedBankEntryDescription = _react2.default.createElement(
  _Text2.default,
  null,
  'Este item foi exclu\xEDdo do banco de itens. Os alunos ainda poder\xE3o v\xEA-lo em tentativas futuras. Para editar, fa\xE7a uma c\xF3pia do item.'
);

var propsForVersioningWrapper = function propsForVersioningWrapper(copyDescription, immutableDescription, isImmutable, shouldClone, setShouldClone, switchOffEditing, isEditing) {
  var alertType = arguments.length > 7 && arguments[7] !== undefined ? 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, _partial2.default)(setShouldClone, true),
      defaultActionText: 'Editar uma c\xF3pia',
      description: immutableDescription,
      disableChildren: true,
      showAlert: true
    });
  }
  return defaultProps;
};

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

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

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

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

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

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

var propsForBankEntryEditPrompt = exports.propsForBankEntryEditPrompt = function propsForBankEntryEditPrompt(isEditing, switchOffEditing, defaultActionCallback, description) {
  if (!isEditing) return { showAlert: false };
  return {
    cancelActionCallback: switchOffEditing,
    disableChildren: true,
    description: description,
    defaultActionCallback: defaultActionCallback,
    defaultActionText: 'Editar no banco',
    showAlert: true
  };
};

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

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

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

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

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