import { useMutation, useQuery } from '@tanstack/react-query';
import * as api from '../service/ProfileService'
import { CheckUserNameType, UpdateEmailType, UpdatePhoneType, UpdateProfileType, VerifyPhoneType } from '../types/ProfileTypes';

export const useGetProfile = () => {
    return useQuery({
        queryKey: ["profile"],
        queryFn: () => api.getProfile(),
    });
};

export const useCheckUserName = () => {
    return useMutation({
        mutationFn: (variables: CheckUserNameType) => api.checkUserName(variables),
    });
};

export const useUpdateProfile = () => {
    return useMutation({
        mutationFn: (variables: UpdateProfileType) => api.updateProfile(variables),
    });
};

export const useUpdateEmail = () => {
    return useMutation({
        mutationFn: (variables: UpdateEmailType) => api.updateEmail(variables),
    });
};

export const useUpdatePhone = () => {
    return useMutation({
        mutationFn: (variables: UpdatePhoneType) => api.updatePhone(variables),
    });
};

export const useVerifyPhone = () => {
    return useMutation({
        mutationFn: (variables: VerifyPhoneType) => api.verifyPhone(variables),
    });
};

export const useSingleUpload = () => {
    return useMutation({
        mutationFn: (variables: FormData) => api.singleUpload(variables),
    });
};