"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowSyncConnector = void 0;
const integration_base_1 = require("@things-factory/integration-base");
const debug = require('debug')('aidoop:integration-base:flow-sync-connector');
class FlowSyncConnector {
    async ready(connectionConfigs) {
        await Promise.all(connectionConfigs.map(this.connect.bind(this)));
        integration_base_1.ConnectionManager.logger.info('flow-sync-connector connections are ready');
    }
    async connect(connection) {
        var { params } = connection;
        var waitCount = 0;
        var releaseCount = 0;
        integration_base_1.ConnectionManager.addConnectionInstance(connection, Object.assign(Object.assign({}, connection), { params,
            waitCount,
            releaseCount }));
        integration_base_1.ConnectionManager.logger.info(`flow-sync-connector connection(${connection.name}:${connection.endpoint}) is connected`);
    }
    async disconnect(connection) {
        integration_base_1.ConnectionManager.removeConnectionInstance(connection);
        integration_base_1.ConnectionManager.logger.info(`flow-sync-connector connection(${connection.name}) is disconnected`);
    }
    get parameterSpec() {
        return [
            {
                type: 'number',
                name: 'syncWaitCount',
                label: 'sync-wait-count'
            }
        ];
    }
    get taskPrefixes() {
        return ['flow-sync'];
    }
    get help() {
        return 'integration/connector/flow-sync-connector';
    }
}
exports.FlowSyncConnector = FlowSyncConnector;
integration_base_1.ConnectionManager.registerConnector('flow-sync-connector', new FlowSyncConnector());
//# sourceMappingURL=flow-sync-connector.js.map