'use client';

import { useMutation, UseMutationOptions } from '@tanstack/react-query';
import { completeOnboardingAction } from '@/app/actions/completeOnboardingAction';
import { Result } from '@/lib/contracts/Result';
import { CompleteOnboardingInputDTO } from '@/lib/types/generated/CompleteOnboardingInputDTO';

export function useCompleteOnboarding(
  options?: Omit<UseMutationOptions<Result<{ success: boolean }, string>, Error, CompleteOnboardingInputDTO>, 'mutationFn'>
) {
  return useMutation<Result<{ success: boolean }, string>, Error, CompleteOnboardingInputDTO>({
    mutationFn: async (input) => {
      return await completeOnboardingAction(input);
    },
    ...options,
  });
}
