"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 utils_1 = require("./utils");
const getProgressVariant = (status) => {
    switch (status) {
        case 'cancelled':
        case 'error':
            return react_core_1.ProgressVariant.danger;
        case 'installed':
            return react_core_1.ProgressVariant.success;
        default:
            return undefined;
    }
};
const getMeasureLocation = (status) => status === 'installed' ? react_core_1.ProgressMeasureLocation.none : react_core_1.ProgressMeasureLocation.top;
const HostProgress = ({ host }) => {
    const { status } = host;
    const stages = (0, utils_1.getHostProgressStages)(host);
    const { currentStage, progressInfo } = (0, utils_1.getHostProgress)(host);
    const currentStageNumber = (0, utils_1.getHostProgressStageNumber)(host);
    const progressLabel = `${currentStage || ''}${progressInfo ? `: ${progressInfo}` : ' '}`;
    return (react_1.default.createElement(react_core_1.Progress, { title: progressLabel, value: currentStageNumber, min: 1, max: stages.length, label: `Step ${currentStageNumber} of ${stages.length}`, valueText: `Step ${currentStageNumber} of ${stages.length}: ${progressLabel}`, variant: getProgressVariant(status), measureLocation: getMeasureLocation(status), size: react_core_1.ProgressSize.sm }));
};
exports.default = HostProgress;
//# sourceMappingURL=HostProgress.js.map