import React from 'react';
import { UserCardProps, InfoType, User } from '../types';
import TooltipAvatar from '../Content/tooltip-avatar';

interface AvatarOnlyCardProps extends Omit<UserCardProps, 'user'> {
  user: User;
  renderCardContent: () => React.ReactNode;
  shouldShowHoverCard: boolean;
}

// AvatarOnly卡片组件，处理仅头像模式的渲染
function AvatarOnlyCard(props: AvatarOnlyCardProps) {
  const { user, infoType, avatarSize = 48, shouldShowHoverCard = false, renderCardContent, ...rest } = props;

  // 对于NameOnly类型使用普通Tooltip
  if (infoType === InfoType.NameOnly) {
    return (
      <TooltipAvatar
        user={user}
        avatarSize={avatarSize}
        shouldShowHoverCard={false}
        renderCardContent={renderCardContent}
        tooltipTitle={user.fullName || user.email || user.did}
        {...rest}
      />
    );
  }

  // 其他类型使用自定义Tooltip或无Tooltip
  return (
    <TooltipAvatar
      user={user}
      avatarSize={avatarSize}
      shouldShowHoverCard={shouldShowHoverCard}
      renderCardContent={renderCardContent}
      {...rest}
    />
  );
}

export default AvatarOnlyCard;
