"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpecialRenderer = void 0;
var react_1 = __importDefault(require("react"));
var classnames_1 = __importDefault(require("classnames"));
var mdm_sdk_1 = require("@reltio/mdm-sdk");
var LocalOffer_1 = __importDefault(require("@mui/icons-material/LocalOffer"));
var AttributeTitle_1 = require("../../../AttributeTitle");
var ReadOnlyAttributesFactory_1 = require("../../../ReadOnlyAttributesFactory");
var Roles_1 = require("../../../Roles");
var Tags_1 = require("../../../Tags");
var styles_1 = require("../../styles");
var SpecialRenderer = function (_a) {
    var values = _a.values, attributeType = _a.attributeType, classes = _a.classes;
    var styles = (0, styles_1.useOneLineStyles)();
    var label = attributeType.label;
    var renderIcon = function (className) {
        return attributeType.uri === mdm_sdk_1.EntityAttrTypes.tags.uri ? react_1.default.createElement(LocalOffer_1.default, { className: className }) : null;
    };
    var renderValue = function (className) {
        switch (attributeType.uri) {
            case mdm_sdk_1.EntityAttrTypes.tags.uri:
                return react_1.default.createElement(Tags_1.Tags, { className: className, values: values });
            case mdm_sdk_1.EntityAttrTypes.roles.uri: {
                return react_1.default.createElement(Roles_1.Roles, { className: className, values: values });
            }
            default: {
                //startDate, endDate, "crosswalk" fake nested subattibutes
                return (react_1.default.createElement(ReadOnlyAttributesFactory_1.ReadOnlyAttribute, { className: className, attributeValue: { value: values[0], uri: '' }, attributeType: attributeType, inlined: true, classes: classes }));
            }
        }
    };
    return (react_1.default.createElement("div", { "data-reltio-id": "special-renderer", className: (0, classnames_1.default)(styles.titleRow, styles.wrapper) },
        renderIcon(styles.titleIcon),
        react_1.default.createElement(AttributeTitle_1.AttributeTitle, { label: label, className: (0, classnames_1.default)(styles.title, classes === null || classes === void 0 ? void 0 : classes.title), "data-reltio-id": "reltio-attribute-label" }),
        renderValue((0, classnames_1.default)(styles.attribute, classes === null || classes === void 0 ? void 0 : classes.content))));
};
exports.SpecialRenderer = SpecialRenderer;
