import { useMutation } from '@tanstack/react-query';
import { useToast } from '../../core/stores/slices/toastSlice';
import { PostRepository } from '@amityco/ts-sdk-react-native';
export const usePendingPostQuery = () => {
  const {
    showToast
  } = useToast();
  const {
    mutate: deletePost
  } = useMutation({
    mutationFn: postId => PostRepository.deletePost(postId, false),
    onSuccess: () => {
      showToast({
        type: 'success',
        message: 'Post deleted.'
      });
    },
    onError: () => {
      showToast({
        type: 'informative',
        message: 'Failed to delete post.'
      });
    }
  });
  const {
    mutate: approvePost
  } = useMutation({
    mutationFn: PostRepository.approvePost,
    onSuccess: () => {
      showToast({
        type: 'success',
        message: 'Post accepted.'
      });
    },
    onError: () => {
      showToast({
        type: 'informative',
        message: 'Failed to accept post. This post has been reviewed by another moderator.'
      });
    }
  });
  const {
    mutate: declinePost
  } = useMutation({
    mutationFn: PostRepository.declinePost,
    onSuccess: () => {
      showToast({
        type: 'success',
        message: 'Post declined.'
      });
    },
    onError: () => {
      showToast({
        type: 'informative',
        message: 'Failed to decline post. This post has been reviewed by another moderator.'
      });
    }
  });
  return {
    deletePost,
    approvePost,
    declinePost
  };
};
//# sourceMappingURL=usePendingPostQuery.js.map