import { IProjectsQueryParams, projectsService } from "@/api/services/project.service";
import { queryKeys } from "@/utils/queryKeys";
import { useQuery } from "@tanstack/react-query";


export const useProjects = (params?: IProjectsQueryParams) => {
  return useQuery({
    queryKey: [...queryKeys.projects, params],
    queryFn: () => projectsService.getProjects(params),
  });
};

export const useProjectById = (id: string) => {
  return useQuery({
    queryKey: queryKeys.project(id),
    queryFn: () => projectsService.getProjectById(id),
    enabled: !!id,
  });
};