"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocalMachineLoginConfigurator = void 0;
const tslib_1 = require("tslib");
const inversify_1 = require("inversify");
const codiac_common_1 = require("@codiac.io/codiac-common");
const codiac_ops_common_1 = require("@codiac.io/codiac-ops-common");
const contracts_1 = require("../../apis/codiac-api/contracts");
let LocalMachineLoginConfigurator = class LocalMachineLoginConfigurator {
    constructor(codiacUser, 
    // @inject(GenRelayClient) private genRelayClient: GenRelayClient,
    // @inject(INTERFACES_CLI.IUserInputProvider) private _ui: IUserInputProvider,
    // @inject(INTERFACES_CLI.IOutputStyler) private _styler: IOutputStyler,
    logger) {
        this.codiacUser = codiacUser;
        this.logger = logger;
    }
    get cloudProvider() {
        return contracts_1.CloudProviderEnum.localMachine;
    }
    /* ***********************************************************************************
     *    ___        _   _
     *   / _ \      | | | |
     *  / /_\ \_   _| |_| |__
     *  |  _  | | | | __| '_ \
     *  | | | | |_| | |_| | | |
     *  \_| |_/\__,_|\__|_| |_|
     *
     * ***********************************************************************************/
    promptToLogin(options) {
        var _a;
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            this.logger.debug("No login required for ".concat(this.cloudProvider));
            const cspUser = {
                provider: this.cloudProvider,
                subscriptionId: "subx-placeholder-for-localMachine",
                tenantCode: this.codiacUser.tenantCode,
                username: (_a = options === null || options === void 0 ? void 0 : options.providedUserName) !== null && _a !== void 0 ? _a : this.codiacUser.username,
                created: new Date(Date.now())
            };
            return [true, cspUser];
        });
    }
    promptToLogout() {
        return tslib_1.__awaiter(this, void 0, void 0, function* () {
            const cspUserName = this.codiacUser.username;
            return [true, cspUserName]; // Just a pass-through.  No authentication required for localMachine.
        });
    }
    assembleLoginRequest(user, secret, subscriptionId, proprietaryInput) {
        return {
            providerCode: this.cloudProvider,
            providerSubscription: subscriptionId,
            username: user,
            secret: secret
        };
    }
};
LocalMachineLoginConfigurator = tslib_1.__decorate([
    (0, inversify_1.injectable)(),
    tslib_1.__param(0, (0, inversify_1.inject)(codiac_ops_common_1.UserNameTenantCode)),
    tslib_1.__param(1, (0, inversify_1.inject)(codiac_common_1.INTERFACES.IBetterLogger)),
    tslib_1.__metadata("design:paramtypes", [codiac_ops_common_1.UserNameTenantCode, Object])
], LocalMachineLoginConfigurator);
exports.LocalMachineLoginConfigurator = LocalMachineLoginConfigurator;
//# sourceMappingURL=local-machine-login-configurator.js.map