import { useQuery } from "@tanstack/react-query";
import { queryKeys } from "./keys";
import { studentProgressService, type StudentProgressFilters } from "@/services/student-progress.service";

export function useStudentProgressList(params?: StudentProgressFilters) {
  return useQuery({
    queryKey: queryKeys.studentProgress.list(params),
    queryFn: () => studentProgressService.listProgress(params),
  });
}

export function useStudentProgressDetail(id: number | null | undefined) {
  return useQuery({
    queryKey: queryKeys.studentProgress.detail(id ?? 0),
    queryFn: () => studentProgressService.getProgress(id as number),
    enabled: !!id,
  });
}
