"use strict";

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 _reduxRecord = _interopRequireDefault(require("./reduxRecord"));

var _instructureValidations = require("instructure-validations");

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

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

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

  (0, _createClass2.default)(Response, [{
    key: "getItem",
    value: function getItem() {
      if (this.itemId) {
        return this.stateHelper().findSessionItem(this.id).getItem();
      }
    }
  }]);
  return Response;
}((0, _reduxRecord.default)({
  attempt: null,
  itemId: null,
  largeFormatResponse: null,
  position: null,
  userResponse: null,
  id: null
}));

exports.default = Response;
Response.validations = {
  userResponse: [(0, _instructureValidations.rule)('maxContent', {
    limit: _constants.TAKE_CHAR_LIMIT
  })]
};