"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isOneQuestionAtATime = exports.getBacktrackingIsAllowed = exports.getActiveQuizSessionItemsCount = exports.getQuizSessionById = exports.getActiveQuizSessionId = exports.getActiveQuizSession = void 0;

var _reselect = require("reselect");

var path = 'quizSessions';

var getActiveQuizSession = function getActiveQuizSession(state) {
  return getQuizSessionById(state, getActiveQuizSessionId(state));
};

exports.getActiveQuizSession = getActiveQuizSession;

var getActiveQuizSessionId = function getActiveQuizSessionId(state) {
  return state.getIn([path, 'activeQuizSessionId']);
};

exports.getActiveQuizSessionId = getActiveQuizSessionId;

var getQuizSessionById = function getQuizSessionById(state, id) {
  return state.getIn([path, id]);
}; // Reselect Selectors


exports.getQuizSessionById = getQuizSessionById;
var getActiveQuizSessionItemsCount = (0, _reselect.createSelector)(getActiveQuizSession, function (activeSession) {
  return activeSession && activeSession.get('sessionItemsCount');
});
exports.getActiveQuizSessionItemsCount = getActiveQuizSessionItemsCount;
var getBacktrackingIsAllowed = (0, _reselect.createSelector)(getActiveQuizSession, function (activeSession) {
  return activeSession && activeSession.get('allowBacktracking');
});
exports.getBacktrackingIsAllowed = getBacktrackingIsAllowed;
var isOneQuestionAtATime = (0, _reselect.createSelector)(getActiveQuizSession, function (activeSession) {
  return activeSession && activeSession.get('oneAtATimeType') === 'question';
});
exports.isOneQuestionAtATime = isOneQuestionAtATime;