import { useQuery, useMutation } from "@tanstack/react-query";
import { analysisService } from "./service";
import type { AnalyzeMatchesDto } from "./types";

export const AnalysisQueryKeys = {
  all: ["analysis"] as const,
  history: () => [...AnalysisQueryKeys.all, "history"] as const,
};

export const useAnalyzeMatches = () => {
  return useMutation({
    mutationFn: (dto: AnalyzeMatchesDto) => analysisService.analyzeMatches(dto),
  });
};

export const useAnalysisHistory = () => {
  return useQuery({
    queryKey: AnalysisQueryKeys.history(),
    queryFn: () => analysisService.getHistory(),
  });
};
