"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 initialState = (0, _immutable.fromJS)({
  selectedParticipantName: null,
  selectedSessions: (0, _immutable.List)(),
  trayOpen: false
});

var _default = function _default() {
  var state = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : initialState;
  var action = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};

  switch (action.type) {
    case _constants.CLOSE_MODERATE_TRAY:
      return state.set('trayOpen', false);

    case _constants.OPEN_MODERATE_TRAY:
      return state.set('selectedParticipantName', action.participant.name).set('selectedSessions', (0, _immutable.List)(action.participant.quizSessionIds)).set('trayOpen', true);

    default:
      return state;
  }
};

exports.default = _default;