"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

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

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

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

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

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

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

var _propTypes = _interopRequireDefault(require("prop-types"));

var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-proptypes"));

var _makeEditable = _interopRequireDefault(require("../../../shared/functionality/makeEditable"));

var _componentForItem = _interopRequireDefault(require("../../../../util/componentForItem"));

var _constants = require("@instructure/quiz-common/lib/constants");

var _interactionTypePropsHelper = require("../../../../util/interactionTypePropsHelper");

var ItemShow =
/*#__PURE__*/
function (_Component) {
  (0, _inherits2.default)(ItemShow, _Component);

  function ItemShow() {
    (0, _classCallCheck2.default)(this, ItemShow);
    return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(ItemShow).apply(this, arguments));
  }

  (0, _createClass2.default)(ItemShow, [{
    key: "render",
    value: function render() {
      var item = this.props.entry;
      var Interaction = (0, _componentForItem.default)(item.getInteractionType().slug, _constants.COMPONENT_SHOW);
      var propsForInteraction = (0, _interactionTypePropsHelper.propsForInteractionShow)(item.toJS());
      return _react.default.createElement(Interaction, Object.assign({}, propsForInteraction, {
        itemId: this.props.guid,
        switchOnEditing: this.props.switchOnEditing
      }));
    }
  }]);
  ItemShow.displayName = "ItemShow";
  return ItemShow;
}(_react.Component);

ItemShow.propTypes = {
  entry: _reactImmutableProptypes.default.record.isRequired,
  guid: _propTypes.default.string.isRequired,
  switchOnEditing: _propTypes.default.func
};
ItemShow.defaultProps = {
  switchOnEditing: null
};

var _default = (0, _makeEditable.default)(ItemShow);

exports.default = _default;