import { useScan } from '../hooks/useScan';

export default function ScanButton() {
  const scan = useScan();

  return (
    <button
      className="aai-btn aai-btn--primary"
      onClick={() => scan.mutate()}
      disabled={scan.isPending}
      aria-busy={scan.isPending}
    >
      {scan.isPending ? (
        <>
          <span className="aai-spinner" aria-hidden="true" />
          Scanning…
        </>
      ) : (
        'Run Scan'
      )}
    </button>
  );
}
