import { useQuery } from "@tanstack/react-query";
import { canDelegate } from "@/record-management/services/api/employeePositionService";
import { useAuthUser } from "@/shared/hooks/useAuthUser";

export const useCanDelegate = () => {
  const { selectedPositionId } = useAuthUser();

  return useQuery({
    queryKey: ["canDelegateStatus", selectedPositionId],
    queryFn: canDelegate,
    enabled: !!selectedPositionId,
    staleTime: 5 * 60 * 1000,
  });
};
