"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "InfluxDbV2BaseService", {
    enumerable: true,
    get: function() {
        return InfluxDbV2BaseService;
    }
});
const _influxdbclient = require("@influxdata/influxdb-client");
const _serverconstants = require("../../server.constants");
class InfluxDbV2BaseService {
    configService;
    logger;
    constructor({ configService, loggerFactory }){
        this.configService = configService;
        this.logger = loggerFactory(InfluxDbV2BaseService.name);
    }
    isConfigValid() {
        const { bucket, org, url, token } = this.getConfig();
        return bucket && org && url && token;
    }
    getConfig() {
        return {
            url: this.configService.get(_serverconstants.AppConstants.influxUrl),
            token: this.configService.get(_serverconstants.AppConstants.influxToken),
            org: this.configService.get(_serverconstants.AppConstants.influxOrg),
            bucket: this.configService.get(_serverconstants.AppConstants.influxBucket)
        };
    }
    getClient() {
        const { url, token } = this.getConfig();
        return new _influxdbclient.InfluxDB({
            url,
            token
        });
    }
}

//# sourceMappingURL=influx-db-v2-base.service.js.map