import { useQuery } from '@tanstack/react-query';

import { chatQueryKeys } from '../chat-query-keys';
import { chatApi, type PostGetBlockedReturn } from '../chat-api';

import type { BaseAxiosError } from '../../../../types';

export const usePostGetBlockedQuery = (token: string, enabled: boolean) => {
  return useQuery<PostGetBlockedReturn, BaseAxiosError>({
    queryKey: chatQueryKeys.getBlocked(token),
    queryFn: async () => {
      const response = await chatApi.getBlocked(token);
      return response.data;
    },
    enabled
  });
};
