"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_core_1 = require("@patternfly/react-core");
const exclamation_triangle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon");
const common_1 = require("../../../common");
const OpenShiftVersionsContext_1 = require("../clusterWizard/OpenShiftVersionsContext");
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const UnsupportedVersion = ({ version }) => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    const hint = (react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.p }, t('ai:Please note that this version is not production-ready.')));
    return (react_1.default.createElement(react_core_1.Content, { component: "p" },
        version,
        " \u00A0",
        react_1.default.createElement(react_core_1.Popover, { bodyContent: hint },
            react_1.default.createElement(react_core_1.Icon, { size: "sm", status: "warning" },
                react_1.default.createElement(exclamation_triangle_icon_1.ExclamationTriangleIcon, null)))));
};
const OpenShiftVersionDetail = ({ cluster }) => {
    const { openshiftVersion } = cluster;
    const { isSupportedOpenShiftVersion, latestVersions: versions } = (0, OpenShiftVersionsContext_1.useOpenShiftVersionsContext)();
    const isSupported = isSupportedOpenShiftVersion(openshiftVersion);
    const version = react_1.default.useMemo(() => {
        return (0, common_1.getOpenshiftVersionText)({
            versions,
            openshiftVersion: openshiftVersion || '',
            cpuArchitecture: cluster.cpuArchitecture,
            withPreviewText: true,
            withMultiText: true,
        });
    }, [versions, cluster.cpuArchitecture, openshiftVersion]);
    return isSupported ? react_1.default.createElement(react_1.default.Fragment, null, version) : react_1.default.createElement(UnsupportedVersion, { version: version || '' });
};
exports.default = OpenShiftVersionDetail;
//# sourceMappingURL=OpenShiftVersionDetail.js.map