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

import { useApiClient } from '@/lib/apiClient';
import { components } from '@/lib/gen';

export type TaxInfoResponse = components['schemas']['TaxInfoSchemaResponse'];

export const useBillingTaxInfo = () => {
  const apiClient = useApiClient();

  const result = useQuery({
    queryKey: ['billing-tax-info'],
    queryFn: async () => {
      const { data } = await apiClient.GET('/api/billing/tax-info');
      return data;
    },
    staleTime: 5 * 60 * 1000,
  });

  return result;
};
