import { useQuery } from '@tanstack/react-query';
import { fetchEditHistory } from '@/lib/submissionItemsService';

/**
 * Phase 4: Hook to fetch edit history for a submission item
 */
export function useEditHistory(itemId: string | null) {
  return useQuery({
    queryKey: ['item-edit-history', itemId],
    queryFn: () => {
      if (!itemId) return [];
      return fetchEditHistory(itemId);
    },
    enabled: !!itemId,
    staleTime: 30000, // 30 seconds
  });
}
