import { useQuery } from '@tanstack/react-query';
import { fetchSprints } from '@/features/projects/services/projectService';

export const sprintsQueryKey = (projectId: string) => ['projects', projectId, 'sprints'] as const;

export function useProjectSprints(projectId: string | undefined) {
  return useQuery({
    queryKey: sprintsQueryKey(projectId ?? ''),
    queryFn: () => fetchSprints(projectId!),
    enabled: Boolean(projectId),
  });
}
