"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfileMatchCard = void 0;
var react_1 = __importDefault(require("react"));
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var classnames_1 = __importDefault(require("classnames"));
var Divider_1 = __importDefault(require("@mui/material/Divider"));
var ProfileCard_1 = require("../ProfileCard");
var MatchRulesBlock_1 = require("../MatchRulesBlock");
var RelevanceScoreBadge_1 = require("../RelevanceScoreBadge");
var styles_1 = require("./styles");
var ProfileMatchCard = function (_a) {
    var _b;
    var children = _a.children, entitiesMap = _a.entitiesMap, entity = _a.entity, match = _a.match, metadata = _a.metadata, className = _a.className;
    var styles = (0, styles_1.useStyles)();
    var showRelevanceBadge = (_b = match.matchRuleSummaries) === null || _b === void 0 ? void 0 : _b.some(mdm_sdk_1.checkMatchRuleSummaryRelevance);
    return (react_1.default.createElement("div", { "data-reltio-id": "profile-match-card", className: (0, classnames_1.default)(styles.root, className) },
        react_1.default.createElement("div", { className: styles.profileCardWrapper },
            react_1.default.createElement(ProfileCard_1.ProfileCard, { entity: match.object, classes: { container: styles.profileCardContainer } }),
            children),
        react_1.default.createElement("div", { className: styles.rulesContainer },
            match.matchRules && (react_1.default.createElement(MatchRulesBlock_1.MatchRulesBlock, { match: match, metadata: metadata, entitiesMap: entitiesMap, entity: entity })),
            showRelevanceBadge && (react_1.default.createElement(react_1.default.Fragment, null,
                react_1.default.createElement("div", { className: styles.dividerWrapper },
                    react_1.default.createElement(Divider_1.default, { orientation: "vertical", className: styles.divider })),
                react_1.default.createElement(RelevanceScoreBadge_1.RelevanceScoreBadge, { className: styles.relevanceBadge, matchRuleSummaries: match.matchRuleSummaries }))))));
};
exports.ProfileMatchCard = ProfileMatchCard;
