"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BootstrapperForAuthDmzCommands = void 0;
require("reflect-metadata");
const codiac_api_1 = require("./apis/codiac-api");
const uilogic_1 = require("./uilogic");
const bootstrapper_for_codiac_cli_1 = require("./bootstrapper-for-codiac-cli");
class BootstrapperForAuthDmzCommands {
    static bootstrap(ioc, cmd) {
        var _a, _b, _c;
        if (this.isBootstrapped == true) {
            return;
        }
        bootstrapper_for_codiac_cli_1.BootstrapperForCodiacCli.bootstrap(ioc, cmd.config, false);
        // We only need the auth client here, so we dont need to run the whole enterprise bootstrapper.
        // Q: Even so, why not just extend CommandBaseExecTenant?  Is that bootstrapper really that slow?
        // A: Because the TenantContextualizer will fire, which we dont want in this case 
        //    bc it doesnt have a registration workflow in it (and shouldnt).
        // This is just a prereq for IAuthClient...
        const codiacApiUrl = (_c = (_b = (_a = cmd.localConfig) === null || _a === void 0 ? void 0 : _a.apiUrl) !== null && _b !== void 0 ? _b : cmd._cliCfg.codiacApiBaseUrl) !== null && _c !== void 0 ? _c : codiac_api_1.CodiacRestClient.DEFAULT_API_URL;
        codiac_api_1.CodiacRestClient.bootstrap(ioc);
        ioc.bind(codiac_api_1.CodiacRestClient).toDynamicValue(() => codiac_api_1.CodiacRestClient.create(cmd.logger, codiacApiUrl));
        // ioc.bind<ICodiacClient>(INTERFACES_CLI_ENTERPRISE.ICodiacClient).toDynamicValue(ctx => ctx.container.get(CodiacRestClient));  // Use the Codiac rest api client for this.
        ioc.bind(uilogic_1.INTERFACES_CLI_ENTERPRISE.IAuthClient).toDynamicValue(ctx => ctx.container.get(codiac_api_1.CodiacRestClient)); // Use the Codiac rest api client for this.
        this.isBootstrapped = true;
    }
}
exports.BootstrapperForAuthDmzCommands = BootstrapperForAuthDmzCommands;
BootstrapperForAuthDmzCommands.isBootstrapped = false;
//# sourceMappingURL=bootstrapper-for-auth-dmz-commands.js.map