"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiskEncryptionMode = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const external_link_alt_icon_1 = require("@patternfly/react-icons/dist/js/icons/external-link-alt-icon");
const react_core_1 = require("@patternfly/react-core");
const config_1 = require("../../../config");
const PopoverIcon_1 = tslib_1.__importDefault(require("../../ui/PopoverIcon"));
const formik_1 = require("../../ui/formik");
const TangServers_1 = require("./TangServers");
const use_translation_wrapper_1 = require("../../../hooks/use-translation-wrapper");
const DiskEncryptionModeTPMv2 = ({ docVersion }) => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (react_1.default.createElement(react_1.default.Fragment, null,
        "TPM v2",
        ' ',
        react_1.default.createElement(PopoverIcon_1.default, { component: 'a', minWidth: "22rem", bodyContent: react_1.default.createElement("p", null,
                t('ai:TPM v2 stores passphrases in a secure cryptoprocessor contained within as server.'),
                "\u00A0",
                react_1.default.createElement("a", { href: (0, config_1.getEncryptingDiskDuringInstallationDocsLink)(docVersion), target: "_blank", rel: "noopener noreferrer" },
                    t('ai:Learn more'),
                    " ",
                    react_1.default.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null))) })));
};
const DiskEncryptionModeTang = ({ docVersion }) => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (react_1.default.createElement(react_1.default.Fragment, null,
        "Tang",
        ' ',
        react_1.default.createElement(PopoverIcon_1.default, { component: 'a', minWidth: "25rem", bodyContent: react_1.default.createElement("p", null,
                t('ai:Tang server component that enable network-bound disk encryption (NBDE).'),
                " \u00A0",
                react_1.default.createElement("a", { href: (0, config_1.getEncryptingDiskDuringInstallationDocsLink)(docVersion), target: "_blank", rel: "noopener noreferrer" },
                    t('ai:Learn more'),
                    " ",
                    react_1.default.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null))) })));
};
const DiskEncryptionMode = ({ diskEncryptionMode, isDisabled, tooltipProps, docVersion, }) => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (react_1.default.createElement(react_core_1.Stack, null,
        react_1.default.createElement(react_core_1.StackItem, null,
            react_1.default.createElement(react_core_1.Flex, null,
                react_1.default.createElement(react_core_1.FlexItem, { spacer: { default: 'spacer3xl' } },
                    react_1.default.createElement(react_core_1.Tooltip, Object.assign({}, tooltipProps),
                        react_1.default.createElement(formik_1.RadioField, { isDisabled: isDisabled, name: "diskEncryptionMode", label: react_1.default.createElement(DiskEncryptionModeTPMv2, { docVersion: docVersion }), id: "TPMV2-button", value: "tpmv2" }))),
                react_1.default.createElement(react_core_1.FlexItem, { spacer: { default: 'spacer3xl' } },
                    react_1.default.createElement(react_core_1.Tooltip, Object.assign({}, tooltipProps),
                        react_1.default.createElement(formik_1.RadioField, { isDisabled: isDisabled, name: "diskEncryptionMode", label: react_1.default.createElement(DiskEncryptionModeTang, { docVersion: docVersion }), id: "tang-button", value: "tang" }))))),
        diskEncryptionMode === 'tang' && (react_1.default.createElement(react_core_1.Stack, null,
            "\u00A0",
            react_1.default.createElement(react_core_1.StackItem, null,
                react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.h6 }, t('ai:Tang servers'))),
            "\u00A0",
            react_1.default.createElement(TangServers_1.TangServers, { isDisabled: isDisabled, tooltipProps: tooltipProps })))));
};
exports.DiskEncryptionMode = DiskEncryptionMode;
//# sourceMappingURL=DiskEncryptionMode.js.map