'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _class, _temp;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactImmutableProptypes = require('react-immutable-proptypes');

var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes);

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

var _makeEditable2 = _interopRequireDefault(_makeEditable);

var _componentForItem = require('../../../../util/componentForItem');

var _componentForItem2 = _interopRequireDefault(_componentForItem);

var _constants = require('../../../../../constants');

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

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

var ItemShow = (_temp = _class = function (_Component) {
  (0, _inherits3.default)(ItemShow, _Component);

  function ItemShow() {
    (0, _classCallCheck3.default)(this, ItemShow);
    return (0, _possibleConstructorReturn3.default)(this, (ItemShow.__proto__ || Object.getPrototypeOf(ItemShow)).apply(this, arguments));
  }

  (0, _createClass3.default)(ItemShow, [{
    key: 'render',
    value: function render() {
      var item = this.props.entry;
      var Interaction = (0, _componentForItem2.default)(item.getInteractionType().slug, _constants.COMPONENT_SHOW);
      var propsForInteraction = (0, _interactionTypePropsHelper.propsForInteractionShow)(item.toJS());

      return _react2.default.createElement(Interaction, Object.assign({}, propsForInteraction, {
        itemId: this.props.guid,
        switchOnEditing: this.props.switchOnEditing
      }));
    }
  }]);
  ItemShow.displayName = 'ItemShow'
  ;
  return ItemShow;
}(_react.Component), _class.propTypes = {
  entry: _reactImmutableProptypes2.default.record.isRequired,
  guid: _propTypes2.default.string.isRequired,
  switchOnEditing: _propTypes2.default.func
}, _class.defaultProps = {
  switchOnEditing: null
}, _temp);
exports.default = (0, _makeEditable2.default)(ItemShow);