"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 use_translation_wrapper_1 = require("../../hooks/use-translation-wrapper");
const DiskLimitations = ({ disk }) => {
    var _a, _b, _c;
    if (!((_a = disk.installationEligibility) === null || _a === void 0 ? void 0 : _a.eligible)) {
        const limitationsCount = ((_c = (_b = disk.installationEligibility) === null || _b === void 0 ? void 0 : _b.notEligibleReasons) === null || _c === void 0 ? void 0 : _c.length) || 0;
        return (react_1.default.createElement(react_core_1.Popover, { headerContent: react_1.default.createElement("div", null, "Disk limitations"), bodyContent: react_1.default.createElement(DiskLimitationsPopoverContent, Object.assign({}, disk.installationEligibility)), minWidth: "30rem", maxWidth: "50rem" },
            react_1.default.createElement(react_core_1.Button, { variant: react_core_1.ButtonVariant.link, isInline: true }, limitationsCount)));
    }
    return null;
};
exports.default = DiskLimitations;
const DiskLimitationsPopoverContent = ({ eligible, notEligibleReasons, }) => {
    const alerts = [];
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    if (!eligible) {
        alerts.push(react_1.default.createElement(react_core_1.Alert, { key: "install-eligibility", variant: react_core_1.AlertVariant.warning, title: t('ai:Disk is not eligible for installation'), isInline: true }, notEligibleReasons && (react_1.default.createElement(react_core_1.List, null, notEligibleReasons.map((reason) => (react_1.default.createElement(react_core_1.ListItem, { key: reason }, reason)))))));
    }
    return react_1.default.createElement(react_1.default.Fragment, null, alerts);
};
//# sourceMappingURL=DiskLimitations.js.map