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 PropTypes from 'prop-types';
import classnames from 'classnames';
import MenuItem from '@mui/material/MenuItem';
import Typography from '@mui/material/Typography';
import { EntityTypeIcon } from '../../../EntityTypeIcon';
import { ExpandedValueTooltip } from '../../../ExpandedValueTooltip';
import { useStyles } from './styles';
export var RelationOption = function (_a) {
    var innerRef = _a.innerRef, innerProps = _a.innerProps, selectOption = _a.selectOption, data = _a.data;
    var styles = useStyles();
    var value = data.value, label = data.label, startObject = data.startObject, endObject = data.endObject;
    var secondaryLabel = startObject.objectType.label + ' \u2194 ' + endObject.objectType.label;
    return (React.createElement(MenuItem, __assign({ className: styles.container, ref: innerRef, key: value, onClick: function () { return selectOption({ label: label, value: value, startObject: startObject, endObject: endObject }); } }, innerProps),
        React.createElement("div", { className: styles.icons },
            React.createElement(EntityTypeIcon, { className: styles.iconTop, entityType: startObject.objectType }),
            React.createElement(EntityTypeIcon, { className: styles.iconBottom, entityType: endObject.objectType })),
        React.createElement("div", { className: styles.text },
            React.createElement(ExpandedValueTooltip, { value: label },
                React.createElement(Typography, { className: classnames(styles.textItem, styles.primaryTextItem) }, label)),
            React.createElement(ExpandedValueTooltip, { value: secondaryLabel },
                React.createElement(Typography, { color: "textSecondary", className: classnames(styles.textItem, styles.secondaryTextItem) }, secondaryLabel)))));
};
RelationOption.propTypes = {
    innerRef: PropTypes.oneOfType([
        PropTypes.oneOf([null]),
        PropTypes.func,
        PropTypes.shape({
            current: PropTypes.any.isRequired
        })
    ]),
    innerProps: PropTypes.object.isRequired,
    selectOption: PropTypes.func.isRequired,
    data: PropTypes.shape({
        value: PropTypes.string.isRequired,
        label: PropTypes.string.isRequired,
        startObject: PropTypes.object,
        endObject: PropTypes.object
    })
};
