'use strict';

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

var _reselect = require('reselect');

var path = 'quizSessions';

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

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

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

// Reselect Selectors
var getActiveQuizSessionItemsCount = exports.getActiveQuizSessionItemsCount = (0, _reselect.createSelector)(getActiveQuizSession, function (activeSession) {
  return activeSession && activeSession.get('sessionItemsCount');
});

var getBacktrackingIsAllowed = exports.getBacktrackingIsAllowed = (0, _reselect.createSelector)(getActiveQuizSession, function (activeSession) {
  return activeSession && activeSession.get('allowBacktracking');
});

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