"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimpleMatchRules = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var classnames_1 = __importDefault(require("classnames"));
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var Tooltip_1 = __importDefault(require("@mui/material/Tooltip"));
var NegativeRuleIcon_1 = __importDefault(require("../icons/NegativeRuleIcon"));
var styles_1 = require("./styles");
var SimpleMatchRules = function (_a) {
    var isMlMatch = _a.isMlMatch, matchRules = _a.matchRules, className = _a.className, matchRuleSummaries = _a.matchRuleSummaries;
    var styles = (0, styles_1.useStyles)();
    var hasMatchRules = matchRules.length > 0;
    var showTitle = !isMlMatch && hasMatchRules;
    return (react_1.default.createElement("div", { "data-reltio-id": "simple-match-rules", className: (0, classnames_1.default)(styles.container, className) },
        react_1.default.createElement("div", { className: showTitle ? styles.bodyWithMargin : styles.bodyWithoutMargin },
            showTitle && react_1.default.createElement("div", { className: styles.title }, ui_i18n_1.default.text('Match rules')),
            react_1.default.createElement("div", { className: styles.labelsContainer }, hasMatchRules
                ? matchRules.map(function (matchRule) {
                    var matchRuleSummary = (0, mdm_sdk_1.getMatchRuleSummary)(matchRuleSummaries, matchRule.uri);
                    var relevancePercentage = (0, mdm_sdk_1.formatRelevanceScore)(matchRuleSummary);
                    return (react_1.default.createElement("div", { className: styles.matchRuleInfo, key: matchRule.uri, "data-reltio-id": "match-rule-info" },
                        react_1.default.createElement("div", { className: styles.matchRuleLabel },
                            "\u2022\u00A0",
                            matchRule.negativeRule && (react_1.default.createElement(NegativeRuleIcon_1.default, { className: styles.negativeRuleIcon })), "".concat(matchRule.label)),
                        relevancePercentage && (react_1.default.createElement(Tooltip_1.default, { title: ui_i18n_1.default.text('Relevance score') },
                            react_1.default.createElement("div", { className: styles.relevanceScore }, relevancePercentage)))));
                })
                : null))));
};
exports.SimpleMatchRules = SimpleMatchRules;
