import { useNavigate } from "@tanstack/react-router";
import { createTeam } from "@/features/teams/server";
import { TeamInput } from "@/features/teams/types";
import { logger } from "@/lib/logger";
import { useServerMutation } from "@/lib/tanstack-query/hooks";

const useCreateTeam = () => {
  const navigate = useNavigate();
  
  return useServerMutation({
    mutationFn: (data: TeamInput) => createTeam({ data }),
    onMutate: (data) => {
      logger.info('Creating team', data);
    },
    successMessage: 'Team created successfully!',
  });
};

export default useCreateTeam;
