"use strict";
// @ts-check
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = grabHostNames;
const https_1 = __importDefault(require("https"));
const http_1 = __importDefault(require("http"));
/**
 *  # Grab Names For Query
 */
function grabHostNames(param) {
    var _a, _b;
    const scheme = process.env.DSQL_HTTP_SCHEME;
    const localHost = process.env.DSQL_LOCAL_HOST;
    const localHostPort = process.env.DSQL_LOCAL_HOST_PORT;
    const remoteHost = ((_a = process.env.DSQL_API_REMOTE_HOST) === null || _a === void 0 ? void 0 : _a.match(/.*\..*/))
        ? process.env.DSQL_API_REMOTE_HOST
        : undefined;
    const remoteHostPort = ((_b = process.env.DSQL_API_REMOTE_HOST_PORT) === null || _b === void 0 ? void 0 : _b.match(/./))
        ? process.env.DSQL_API_REMOTE_HOST_PORT
        : undefined;
    return {
        host: remoteHost || localHost || "datasquirel.com",
        port: remoteHostPort || localHostPort || 443,
        scheme: (scheme === null || scheme === void 0 ? void 0 : scheme.match(/^http$/i)) ? http_1.default : https_1.default,
        user_id: (param === null || param === void 0 ? void 0 : param.userId) || String(process.env.DSQL_API_USER_ID || 0),
    };
}