"use strict";

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

var _immutable = require("immutable");

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

var _default = function _default() {
  var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : (0, _immutable.fromJS)({
    OPEN_ADD_CONTENT_MODAL_DATA: {
      allowStimulusCreation: false,
      modalOpen: false,
      position: 0,
      quizId: "",
      stimulusId: ""
    }
  });
  var action = arguments.length > 1 ? arguments[1] : void 0;

  switch (action.type) {
    case _constants.OPEN_DELETE_STIMULUS_MODAL:
      return state.set('isOpen', _constants.DELETE_STIMULUS_MODAL);

    case _constants.OPEN_ADD_CONTENT_MODAL:
      return state.set('isOpen', _constants.ADD_CONTENT_MODAL).set(_constants.OPEN_ADD_CONTENT_MODAL_DATA, (0, _immutable.Map)(action.payload));

    case _constants.OPEN_MOVE_IMMUTABLE_MODAL:
      return state.set('isOpen', _constants.MOVE_IMMUTABLE_MODAL);

    case _constants.OPEN_MODAL:
      return state.set('isOpen', action.payload.title).set('options', (0, _immutable.Map)(action.payload.options));

    case _constants.CLOSE_MODAL:
      return state.set('isOpen', false);

    default:
      return state;
  }
};

exports.default = _default;