'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.fakeStreamQueueCreator = exports.fakeStreamConfigCreator = exports.fakeKinesisClientCreator = exports.fakeKinesisConfigCreator = exports.numRecords = undefined;

var _kinesis = require('aws-sdk/clients/kinesis');

var _kinesis2 = _interopRequireDefault(_kinesis);

var _StreamQueue = require('../StreamQueue');

var _StreamQueue2 = _interopRequireDefault(_StreamQueue);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var numRecords = exports.numRecords = function numRecords(stream) {
  return 1;
};

var fakeKinesisConfigCreator = exports.fakeKinesisConfigCreator = function fakeKinesisConfigCreator() {
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

  return {
    client: fakeKinesisClientCreator(),
    streamConfigs: [fakeStreamConfigCreator()]
  };
};

var fakeKinesisClientCreator = exports.fakeKinesisClientCreator = function fakeKinesisClientCreator() {
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

  var kinesisConfig = config || {
    apiVersion: '2013-12-02',
    region: 'us-west-2',
    endpoint: 'kinesis.docker' };

  return new _kinesis2.default(kinesisConfig);
};

var fakeStreamConfigCreator = exports.fakeStreamConfigCreator = function fakeStreamConfigCreator() {
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

  return {
    eventTypes: { EVENT: function EVENT() {} },
    maxPageSize: 5, // max number events sent at once
    sendRecordsTimeout: 1000, // in milliseconds
    stream: 'KinesisResponsesStreamName',
    whiny: true
  };
};

var fakeStreamQueueCreator = exports.fakeStreamQueueCreator = function fakeStreamQueueCreator() {
  var kinesis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fakeKinesisClientCreator();
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : fakeStreamConfigCreator();

  return new _StreamQueue2.default({ config: config, kinesis: kinesis });
};