// ---------------------------------------------------------------------------
// Drive/Git status sub-line for FolderCard
// ---------------------------------------------------------------------------

import { SpinnerIcon, XIcon, WarningIcon } from '@/components/ui/icons'
import type { FolderEntry } from '@/lib/client-types'

interface DriveStatusLineProps {
  driveStatus: NonNullable<FolderEntry['driveStatus']>
  driveError?: string
}

export default function DriveStatusLine({ driveStatus, driveError }: DriveStatusLineProps) {
  if (driveStatus === 'pending') return null

  return (
    <div className="flex items-center gap-1.5 mt-0.5">
      {driveStatus === 'uploading' && (
        <>
          <SpinnerIcon className="w-3 h-3 text-gray-400" />
          <span className="text-xs text-gray-400">Upload Drive en cours...</span>
        </>
      )}
      {driveStatus === 'success' && (
        <>
          <SpinnerIcon className="w-3 h-3 text-gray-400" />
          <span className="text-xs text-gray-400">Upload Git en cours...</span>
        </>
      )}
      {driveStatus === 'error' && (
        <>
          <XIcon className="w-3 h-3 text-red-400" />
          <span className="text-xs text-red-400 truncate">Drive echoue{driveError ? ` : ${driveError}` : ''}</span>
        </>
      )}
      {driveStatus === 'skipped' && (
        <>
          <WarningIcon className="w-3 h-3 text-yellow-400" />
          <span className="text-xs text-yellow-400">Drive ignore</span>
        </>
      )}
    </div>
  )
}
