"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const types_1 = require("../../types");
const TechnologyPreview_1 = require("../ui/TechnologyPreview");
const DeveloperPreview_1 = require("../ui/DeveloperPreview");
const FeatureSupportLevelContext_1 = require("./FeatureSupportLevelContext");
const FeatureSupportLevelBadge = ({ featureId, openshiftVersion, }) => {
    const featureSupportLevelData = (0, FeatureSupportLevelContext_1.useFeatureSupportLevel)();
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    const supportLevel = react_1.default.useMemo(() => {
        if (!openshiftVersion) {
            return undefined;
        }
        // eslint-disable-next-line @typescript-eslint/no-unsafe-return
        return featureSupportLevelData.getFeatureSupportLevel(openshiftVersion, featureId);
    }, [openshiftVersion, featureId, featureSupportLevelData]);
    if (!(0, types_1.isPreviewSupportLevel)(supportLevel)) {
        return null;
    }
    const testId = `${featureId}-support-level`;
    return supportLevel === 'tech-preview' ? (react_1.default.createElement(TechnologyPreview_1.TechnologyPreview, { testId: testId })) : (react_1.default.createElement(DeveloperPreview_1.DeveloperPreview, { testId: testId }));
};
exports.default = FeatureSupportLevelBadge;
//# sourceMappingURL=FeatureSupportLevelBadge.js.map