import { useQuery } from '@tanstack/react-query';
import { api } from '../lib/api';
import type { ApiResponse } from '../lib/api';

export function usePaymentConfig() {
  const { data } = useQuery<ApiResponse<{ test_mode: boolean }>>({
    queryKey: ['payment-config'],
    queryFn: () => api.get('/api/v1/payment/config'),
    staleTime: 5 * 60 * 1000,
  });
  return { isTestMode: data?.data?.test_mode ?? false };
}
