/**
 * 文件图标组件
 * 根据文件名后缀显示不同类型的图标
 */
interface FileIconProps {
  fileName: string;
  className?: string;
  size?: 'default' | 'sm' | 'lg';
}

export function FileIcon({ fileName, className = '', size }: FileIconProps) {
  const sizeClass = size ? `file-icon-${size}` : '';
  
  let fileType = 'unknown';
  let iconClass = 'ri-file-line';
  
  if (fileName.endsWith('.pdf')) {
    fileType = 'pdf';
    iconClass = 'ri-file-pdf-line';
  } else if (fileName.endsWith('.docx') || fileName.endsWith('.doc')) {
    fileType = 'doc';
    iconClass = 'ri-file-word-2-line';
  } else if (fileName.endsWith('.xlsx') || fileName.endsWith('.xls')) {
    fileType = 'xls';
    iconClass = 'ri-file-excel-2-line';
  } else if (fileName.endsWith('.pptx') || fileName.endsWith('.ppt')) {
    fileType = 'ppt';
    iconClass = 'ri-file-ppt-2-line';
  } else if (fileName.endsWith('.zip') || fileName.endsWith('.rar')) {
    fileType = 'zip';
    iconClass = 'ri-file-zip-line';
  } else if (fileName.endsWith('.png') || fileName.endsWith('.jpg') || fileName.endsWith('.jpeg') || fileName.endsWith('.gif')) {
    fileType = 'img';
    iconClass = 'ri-image-line';
  } else if (fileName.endsWith('.txt')) {
    fileType = 'txt';
    iconClass = 'ri-file-text-line';
  }
  
  return (
    <span className={`file-icon file-icon-${fileType} ${sizeClass} ${className}`}>
      <i className={iconClass}></i>
    </span>
  );
} 