import { useQuery } from '@tanstack/react-query';
import { searchMitreTechniques } from '@/api/mitre';

export function useMitreSearch(query: string, enabled: boolean) {
  return useQuery({
    queryKey: ['mitre', 'techniques', query],
    queryFn: () => searchMitreTechniques(query),
    enabled: enabled && query.trim().length > 0,
    staleTime: 5 * 60 * 1000,
  });
}
