"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClusterStatusText = exports.ClusterStatusIcon = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
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 file_alt_icon_1 = require("@patternfly/react-icons/dist/js/icons/file-alt-icon");
const check_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/check-circle-icon");
const in_progress_icon_1 = require("@patternfly/react-icons/dist/js/icons/in-progress-icon");
const ban_icon_1 = require("@patternfly/react-icons/dist/js/icons/ban-icon");
const common_1 = require("../../../common");
const use_translation_wrapper_1 = require("../../../common/hooks/use-translation-wrapper");
const react_core_1 = require("@patternfly/react-core");
const ClusterStatusIcon = (_a) => {
    var { status } = _a, extraProps = tslib_1.__rest(_a, ["status"]);
    switch (status) {
        case 'cancelled':
            return (react_1.default.createElement(react_core_1.Icon, { size: "sm" },
                react_1.default.createElement(ban_icon_1.BanIcon, Object.assign({}, extraProps))));
        case 'insufficient':
        case 'pending-for-input':
        case 'ready':
            return (react_1.default.createElement(react_core_1.Icon, { size: "sm" },
                react_1.default.createElement(file_alt_icon_1.FileAltIcon, Object.assign({}, extraProps))));
        case 'error':
            return (react_1.default.createElement(react_core_1.Icon, { size: "sm", status: "danger" },
                react_1.default.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, Object.assign({}, extraProps))));
        case 'installed':
            return (react_1.default.createElement(react_core_1.Icon, { status: "success", size: "sm" },
                react_1.default.createElement(check_circle_icon_1.CheckCircleIcon, Object.assign({}, extraProps))));
        case 'installing-pending-user-action':
            return (react_1.default.createElement(react_core_1.Icon, { size: "sm", status: "warning" },
                react_1.default.createElement(exclamation_triangle_icon_1.ExclamationTriangleIcon, Object.assign({}, extraProps))));
        case 'preparing-for-installation':
        case 'installing':
        case 'finalizing':
        case 'adding-hosts':
            return (react_1.default.createElement(react_core_1.Icon, { size: "sm" },
                react_1.default.createElement(in_progress_icon_1.InProgressIcon, Object.assign({}, extraProps))));
        default:
            return react_1.default.createElement(react_1.default.Fragment, null);
    }
};
exports.ClusterStatusIcon = ClusterStatusIcon;
const getClusterStatusText = (t, status) => {
    return (0, common_1.clusterStatusLabels)(t)[status] || status;
};
exports.getClusterStatusText = getClusterStatusText;
const ClusterStatus = ({ status, testId, className, }) => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    const title = (0, exports.getClusterStatusText)(t, status);
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement(exports.ClusterStatusIcon, { status: status, "data-testid": testId, className: className }),
        " ",
        title));
};
exports.default = ClusterStatus;
//# sourceMappingURL=ClusterStatus.js.map