"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FallbackIndicator = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var Typography_1 = __importDefault(require("@mui/material/Typography"));
var CheckCircle_1 = __importDefault(require("@mui/icons-material/CheckCircle"));
var CancelOutlined_1 = __importDefault(require("@mui/icons-material/CancelOutlined"));
var Info_1 = __importDefault(require("@mui/icons-material/Info"));
var MdmModuleContext_1 = require("../../../../../contexts/MdmModuleContext");
var helpers_1 = require("../../helpers");
var withTooltip_1 = require("../../../../../HOCs/withTooltip");
var FallbackIndicator_module_css_1 = __importDefault(require("./FallbackIndicator.module.css"));
var InfoIconWithTooltip = (0, withTooltip_1.withTooltip)(Info_1.default);
var FallbackIndicator = function (_a) {
    var ovDetails = _a.ovDetails;
    var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
    var fallbackLabels = (0, helpers_1.getFallbackLabels)(metadata, ovDetails);
    var renderTooltip = function () {
        return (react_1.default.createElement("div", { className: FallbackIndicator_module_css_1.default.fallbackList },
            react_1.default.createElement(Typography_1.default, { variant: "caption", className: FallbackIndicator_module_css_1.default.fallbackTitle }, ui_i18n_1.default.text('OV decision path')),
            fallbackLabels.map(function (label, index) { return (react_1.default.createElement("div", { key: index, className: FallbackIndicator_module_css_1.default.fallbackItem },
                index === fallbackLabels.length - 1 ? (react_1.default.createElement(CheckCircle_1.default, { className: FallbackIndicator_module_css_1.default.fallbackItemIcon })) : (react_1.default.createElement(CancelOutlined_1.default, { className: FallbackIndicator_module_css_1.default.fallbackItemIcon })),
                react_1.default.createElement(Typography_1.default, { variant: "caption" }, label))); })));
    };
    return fallbackLabels.length > 0 ? (react_1.default.createElement(InfoIconWithTooltip, { tooltipTitle: renderTooltip(), className: FallbackIndicator_module_css_1.default.fallbackIcon })) : null;
};
exports.FallbackIndicator = FallbackIndicator;
