import React, { forwardRef } from 'react';
import { identity } from 'ramda';
import MenuItem from '@mui/material/MenuItem';
import Typography from '@mui/material/Typography';
import { TenantIcon } from '../../../TenantIcon';
import { useStyles } from './styles';
export var TenantMenuItem = forwardRef(function (_a, ref) {
    var item = _a.item, _b = _a.onMenuClose, onMenuClose = _b === void 0 ? identity : _b;
    var styles = useStyles();
    var tenant = item.tenant, onClick = item.onClick;
    var handleClick = function () {
        onMenuClose();
        onClick(tenant);
    };
    var tenantCaption = tenant.label ? "".concat(tenant.label, " : ").concat(tenant.name) : tenant.name;
    return (React.createElement(MenuItem, { onClick: handleClick, ref: ref, className: styles.root },
        React.createElement(TenantIcon, { tenant: tenant }),
        React.createElement(Typography, null, tenantCaption || tenant.id)));
});
TenantMenuItem.displayName = 'TenantMenuItem';
