"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MetaInfoList = void 0;
var react_1 = __importStar(require("react"));
var Box_1 = __importDefault(require("@mui/material/Box"));
var ReadOnlyAttributesPager_1 = require("../../../ReadOnlyAttributesPager");
var MetaInfoItem_1 = require("../MetaInfoItem");
var helpers_1 = require("../../helpers");
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
var styles_1 = require("./styles");
var MetaInfoList = function (_a) {
    var attributeValue = _a.attributeValue, attributeType = _a.attributeType, imageAttributeFieldsOrder = _a.imageAttributeFieldsOrder;
    var styles = (0, styles_1.useStyles)();
    var isViewMode = (0, MdmModuleContext_1.useMdmIsViewMode)();
    var systemAttributesList = (0, helpers_1.getSystemAttributesList)(attributeValue, imageAttributeFieldsOrder);
    var notSystemAttributesList = (0, helpers_1.getNotSystemAttributesList)(attributeValue, attributeType, imageAttributeFieldsOrder);
    var attributesClasses = (0, react_1.useMemo)(function () { return ({
        title: styles.title,
        content: styles.content
    }); }, [styles]);
    return (react_1.default.createElement(Box_1.default, { "data-reltio-id": "image-meta-info-list", className: styles.root },
        systemAttributesList.map(function (_a) {
            var title = _a.title, value = _a.value, isLink = _a.isLink;
            return (react_1.default.createElement(MetaInfoItem_1.MetaInfoItem, { key: title, isLink: isLink, title: title, content: value }));
        }),
        isViewMode &&
            notSystemAttributesList.map(function (_a) {
                var attrType = _a.attrType, values = _a.values;
                return (react_1.default.createElement(ReadOnlyAttributesPager_1.ReadOnlyAttributesPager, { key: attrType.uri, attributeType: attrType, drawLines: false, values: values, classes: attributesClasses, parentUri: attributeValue.uri }));
            })));
};
exports.MetaInfoList = MetaInfoList;
