'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getResponseByPosition = exports.getIsTaking = exports.getTimerData = exports.getBrowserSessionId = exports.getCurrentSessionItemPosition = undefined;

var _immutable = require('immutable');

var path = 'taking';

var getCurrentSessionItemPosition = exports.getCurrentSessionItemPosition = function getCurrentSessionItemPosition(state) {
  return state.getIn([path, 'currentSessionItemPosition'], 1);
};

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

var getTimerData = exports.getTimerData = function getTimerData(state) {
  return state.getIn([path, 'timerData'], (0, _immutable.Map)());
};

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

var getResponseByPosition = exports.getResponseByPosition = function getResponseByPosition(state, position) {
  return getResponses(state).find(function (response) {
    return response.get('position') === position;
  }) || (0, _immutable.Map)();
};

// Helpers
var getResponses = function getResponses(state) {
  return state.getIn([path, 'responses'], (0, _immutable.List)());
};