"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNestedPathByColumnId = exports.getAttrPathFromColumnId = exports.getAttributeHeight = exports.IMAGE_HEIGHT = exports.BLOB_HEIGHT = exports.REFERENCE_HEIGHT = void 0;
var ramda_1 = require("ramda");
var mdm_sdk_1 = require("@reltio/mdm-sdk");
exports.REFERENCE_HEIGHT = 28;
exports.BLOB_HEIGHT = 100;
exports.IMAGE_HEIGHT = 76;
var PADDING = 17;
var getAttributeHeight = function (_a) {
    var columnData = _a.columnData, cell = _a.cell;
    var countAttributes = cell.values.length;
    var defaultHeight = 28 * Math.max(countAttributes, 1) + 20;
    if (!countAttributes) {
        return defaultHeight;
    }
    switch ((0, ramda_1.path)(['dataTypeDefinition', 'type'], columnData)) {
        case 'Reference':
            return exports.REFERENCE_HEIGHT * countAttributes + PADDING;
        case 'Blob':
            return exports.BLOB_HEIGHT * countAttributes;
        case 'Image':
            return exports.IMAGE_HEIGHT * countAttributes + PADDING;
        default:
            return defaultHeight;
    }
};
exports.getAttributeHeight = getAttributeHeight;
exports.getAttrPathFromColumnId = (0, ramda_1.split)('.');
var getNestedPathByColumnId = function (columnId) {
    if ((0, mdm_sdk_1.isAttributeSearchUri)(columnId)) {
        var _a = (0, exports.getAttrPathFromColumnId)(columnId), attrPath = _a.slice(1);
        return attrPath.length > 1 ? attrPath.slice(0, -1) : null;
    }
    else {
        return null;
    }
};
exports.getNestedPathByColumnId = getNestedPathByColumnId;
