import { useQuery, skipToken } from '@tanstack/react-query';
import { apiClient } from '@/api/client';

export function useDownloadUrl(objectId?: string) {
  return useQuery({
    queryKey: ['download-url', objectId],
    queryFn: objectId
      ? () => apiClient.getParticleDownloadUrl(objectId)
      : skipToken,
    staleTime: 1000 * 60 * 60, // 1 hour — signed URLs valid for 24h
  });
}
