"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mqttClient = exports.KEEP_ALIVE = void 0;
var aws_iot_device_sdk_1 = require("aws-iot-device-sdk");
// seconds; see https://docs.aws.amazon.com/general/latest/gr/iot-core.html#iot-protocol-limits.
// At 1.5x the keep-alive AWS will publish a "disconnected" life-cycle event:
// https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html.
exports.KEEP_ALIVE = 30;
exports.mqttClient = function (_a) {
    var caCert = _a.caCert, clientCert = _a.clientCert, privateKey = _a.privateKey, id = _a.id, endpoint = _a.endpoint;
    return new aws_iot_device_sdk_1.device({
        privateKey: privateKey,
        clientCert: clientCert,
        caCert: caCert,
        clientId: id,
        host: endpoint,
        region: endpoint.split('.')[2],
        debug: false,
        keepalive: exports.KEEP_ALIVE,
    });
};
