"use strict";

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

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

var assembleKinesisConfig = function assembleKinesisConfig(apiConfig) {
  return Object.assign({
    apiVersion: '2013-12-02'
  }, apiConfig);
}; // We don't really want to delay sending events for this queue.


exports.assembleKinesisConfig = assembleKinesisConfig;

var responseStreamConfig = function responseStreamConfig(defaultStreamConfig, stream) {
  return Object.assign({}, defaultStreamConfig, {
    eventTypes: {
      RESPONSE: _eventTypes.RESPONSE
    },
    maxPageSize: 1,
    stream: stream
  });
};

exports.responseStreamConfig = responseStreamConfig;

var 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
  });
};

exports.eventStreamConfig = eventStreamConfig;

var 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)];
};

exports.assembleStreamConfigs = assembleStreamConfigs;