import { useQuery, useMutation } from "@tanstack/react-query";
import { queryKeys } from "./keys";
import { signupService } from "@/services/signup.service";
import type { RegisterRequest, VerifyEmailRequest, OnboardingData } from "@/types";

export function useGoals() {
  return useQuery({
    queryKey: queryKeys.signup.goals,
    queryFn: signupService.getGoals,
  });
}

export function useRegister() {
  return useMutation({
    mutationFn: (data: RegisterRequest) => signupService.register(data),
  });
}

export function useVerifyEmail() {
  return useMutation({
    mutationFn: (data: VerifyEmailRequest) => signupService.verifyEmail(data),
  });
}

export function useResendOtp() {
  return useMutation({
    mutationFn: (email: string) => signupService.resendOtp({ email }),
  });
}

export function useCheckEmail() {
  return useMutation({
    mutationFn: (email: string) => signupService.checkEmail(email),
  });
}

export function useCompleteOnboarding() {
  return useMutation({
    mutationFn: (data: OnboardingData) => signupService.completeOnboarding(data),
  });
}
