"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOpenshiftVersionHelperText = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_core_1 = require("@patternfly/react-core");
const common_1 = require("../../../common");
const exclamation_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-circle-icon");
const exclamation_triangle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-triangle-icon");
const external_link_alt_icon_1 = require("@patternfly/react-icons/dist/js/icons/external-link-alt-icon");
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const OpenShiftLifeCycleDatesLink = () => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (React.createElement("a", { href: common_1.OPENSHIFT_LIFE_CYCLE_DATES_LINK, target: "_blank", rel: "noopener noreferrer" },
        t('ai:Learn more'),
        " ",
        React.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null)));
};
const getOpenshiftVersionHelperText = (versions, selectedVersionValue, t, isModal) => {
    if (!versions.length && !isModal) {
        return (React.createElement(React.Fragment, null,
            React.createElement(react_core_1.Icon, { status: "danger", size: "sm" },
                React.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, null)),
            "\u00A0 ",
            t('ai:No release image is available.')));
    }
    const selectedVersion = versions.find((version) => version.value === selectedVersionValue);
    if (!selectedVersionValue || !selectedVersion) {
        return null;
    }
    if (selectedVersion.supportLevel !== 'production' &&
        selectedVersion.supportLevel !== 'maintenance') {
        let messageSelectedVersion = t('ai:Please note that this version is not production-ready.');
        if (selectedVersion.supportLevel === 'end-of-life') {
            messageSelectedVersion = t('ai:Please note that this version is not maintained anymore.');
        }
        return (React.createElement(React.Fragment, null,
            React.createElement(react_core_1.Icon, { status: "warning" },
                React.createElement(exclamation_triangle_icon_1.ExclamationTriangleIcon, null)),
            "\u00A0",
            messageSelectedVersion,
            "\u00A0",
            React.createElement(OpenShiftLifeCycleDatesLink, null)));
    }
    return null;
};
exports.getOpenshiftVersionHelperText = getOpenshiftVersionHelperText;
//# sourceMappingURL=OpenshiftVersionHelperText.js.map