var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React from 'react';
import i18n from 'ui-i18n';
import classNames from 'classnames';
import MenuItem from '@mui/material/MenuItem';
import { EntityTypeIcon } from '../../../EntityTypeIcon';
import { ExpandedValueTooltip } from '../../../ExpandedValueTooltip';
import { useStyles } from './styles';
export var EntityOption = function (_a) {
    var innerRef = _a.innerRef, innerProps = _a.innerProps, selectOption = _a.selectOption, data = _a.data, isFocused = _a.isFocused;
    var styles = useStyles();
    var uri = data.uri, entityType = data.entityType, label = data.label, secondaryLabel = data.secondaryLabel;
    if (uri !== '') {
        return (React.createElement(MenuItem, __assign({ className: classNames(styles.entityContainer, { focused: isFocused }), ref: innerRef, key: uri, onClick: function () { return selectOption({ label: label, uri: uri, entityType: entityType }); } }, innerProps),
            React.createElement(EntityTypeIcon, { className: styles.entityAvatar, entityType: entityType }),
            React.createElement(ExpandedValueTooltip, { value: "".concat(label).concat(secondaryLabel ? ', ' + secondaryLabel : '') },
                React.createElement("span", { className: styles.entityLabel },
                    label,
                    secondaryLabel && React.createElement("span", { className: styles.entitySecondaryLabel },
                        ", ",
                        secondaryLabel)))));
    }
    else {
        return (React.createElement(MenuItem, __assign({ className: styles.entityContainer, ref: innerRef, key: uri }, innerProps, { disabled: true }),
            React.createElement("span", { className: styles.emptyEntityLabel }, i18n.text('No results found'))));
    }
};
