import { UserRepository } from '@amityco/ts-sdk-react-native';
import { useMutation } from '@tanstack/react-query';
import { useToast } from '../../../core/stores/slices/toastSlice';
import { TOAST } from '../../../core/constants';
export function usePendingFollowRequest() {
  const {
    showToast
  } = useToast();
  const {
    mutate: acceptMutate,
    isPending: isAcceptPending
  } = useMutation({
    mutationFn: UserRepository.Relationship.acceptMyFollower
  });
  const {
    mutate: declineMutate,
    isPending: isDeclinePending
  } = useMutation({
    mutationFn: UserRepository.Relationship.declineMyFollower
  });
  const acceptRequest = (userId, displayName) => {
    acceptMutate(userId, {
      onSuccess: () => {
        showToast({
          type: 'success',
          message: TOAST.USER.FOLLOW_REQUEST.ACCEPT.SUCCESS(displayName)
        });
      }
    });
  };
  const declineRequest = userId => {
    declineMutate(userId, {
      onSuccess: () => {
        showToast({
          type: 'success',
          message: TOAST.USER.FOLLOW_REQUEST.DECLINE.SUCCESS
        });
      }
    });
  };
  return {
    acceptRequest,
    declineRequest,
    isLoading: isAcceptPending || isDeclinePending
  };
}
//# sourceMappingURL=usePendingFollowRequest.js.map