"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributesChanges = void 0;
var react_1 = __importDefault(require("react"));
var ShowMoreLink_1 = require("./components/ShowMoreLink");
var DCRChangesList_1 = require("./components/DCRChangesList");
var AttributesChangesContext_1 = require("./AttributesChangesContext");
var useCollapsibleList_1 = require("./useCollapsibleList");
var DCREntityUriLink_1 = require("../DCREntityUriLink/DCREntityUriLink");
var useChangesList_1 = require("../hooks/useChangesList");
var AttributesChanges_module_css_1 = __importDefault(require("./AttributesChanges.module.css"));
var AttributesChanges = function (_a) {
    var changes = _a.changes, dcrUri = _a.dcrUri, objectsInfo = _a.objectsInfo, entityInfo = _a.entityInfo, relationsInfo = _a.relationsInfo, max = _a.max;
    var changesList = (0, useChangesList_1.useChangesList)({ changes: changes, entityInfo: entityInfo, relationsInfo: relationsInfo });
    var _b = (0, useCollapsibleList_1.useCollapsibleList)(changesList, max), isExpanded = _b.isExpanded, onToggle = _b.onToggle, itemsToShow = _b.itemsToShow, collapsedSuggestionsCount = _b.collapsedSuggestionsCount;
    return (react_1.default.createElement(AttributesChangesContext_1.AttributesChangesContext.Provider, { value: objectsInfo },
        react_1.default.createElement("div", { className: AttributesChanges_module_css_1.default.container, "data-reltio-id": "changes-container" },
            react_1.default.createElement(DCREntityUriLink_1.DCREntityUriLink, { entityInfo: entityInfo, changes: changes, dcrUri: dcrUri }),
            react_1.default.createElement(DCRChangesList_1.DCRChangesList, { changes: itemsToShow }),
            collapsedSuggestionsCount > 0 && (react_1.default.createElement(ShowMoreLink_1.ShowMoreLink, { onClick: onToggle, suggestionsCount: collapsedSuggestionsCount, isExpanded: isExpanded, className: AttributesChanges_module_css_1.default.showMoreLink })))));
};
exports.AttributesChanges = AttributesChanges;
