import React from 'react';
import { Box } from '@mui/material';
import { InfoType, UserCardProps, User } from '../types';
import MinimalContent from '../Content/minimal';
import BasicContent from '../Content/basic';

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

// 详细卡片模式下的Basic渲染组件
function BasicCard({ ...props }: BasicCardProps) {
  const {
    user,
    avatarSize = 40,
    renderCustomContent,
    infoType = InfoType.Minimal,
    renderFields,
    popupRenderFields,
    ...rest
  } = props;

  return (
    <Box
      sx={{
        display: 'flex',
        flexDirection: 'column',
        width: '100%',
        flex: 1,
        height: '100%',
      }}>
      <MinimalContent user={user} avatarSize={avatarSize} {...rest} />
      {infoType === InfoType.Basic && <BasicContent user={user} renderFields={renderFields} />}
      <Box className="user-card__footer">
        {renderCustomContent && <Box sx={{ mt: 1.5 }}>{renderCustomContent()}</Box>}
      </Box>
    </Box>
  );
}

export default BasicCard;
