'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.assembleStreamConfigs = exports.eventStreamConfig = exports.responseStreamConfig = exports.assembleKinesisConfig = undefined;

var _eventTypes = require('./eventTypes');

var assembleKinesisConfig = exports.assembleKinesisConfig = function assembleKinesisConfig(apiConfig) {
  return Object.assign({ apiVersion: '2013-12-02' }, apiConfig);
};

// We don't really want to delay sending events for this queue.
var responseStreamConfig = exports.responseStreamConfig = function responseStreamConfig(defaultStreamConfig, stream) {
  return Object.assign({}, defaultStreamConfig, {
    eventTypes: { RESPONSE: _eventTypes.RESPONSE },
    maxPageSize: 1,
    stream: stream
  });
};

var eventStreamConfig = exports.eventStreamConfig = function eventStreamConfig(defaultStreamConfig, stream) {
  return Object.assign({}, defaultStreamConfig, {
    eventTypes: {
      RESPONSE: _eventTypes.EVENT_RESPONSE, SESSION_STARTED_OR_RESUMED_EVENT: _eventTypes.SESSION_STARTED_OR_RESUMED_EVENT, QUIZ_SUBMISSION_EVENT: _eventTypes.QUIZ_SUBMISSION_EVENT
    },
    stream: stream
  });
};

var assembleStreamConfigs = exports.assembleStreamConfigs = function assembleStreamConfigs(config) {
  var defaultStreamConfig = Object.assign({
    maxPageSize: 25, // max number events sent at once
    sendRecordsTimeout: 5000 // in milliseconds
  }, config.stream_configuration);

  return [eventStreamConfig(defaultStreamConfig, config.stream_identifiers.events), responseStreamConfig(defaultStreamConfig, config.stream_identifiers.responses)];
};