import { useMutation, useQueryClient } from '@tanstack/react-query'
import { reactivateChargeableCharConfig } from '../api/reactivateChargeableCharConfig'

export function useReactivateChargeableCharConfig() {
  const queryClient = useQueryClient()
  return useMutation({
    mutationFn: (id: number) => reactivateChargeableCharConfig(id),
    onSuccess: (_data, id) => {
      queryClient.invalidateQueries({ queryKey: ['chargeableChars', 'list'] })
      queryClient.invalidateQueries({ queryKey: ['chargeableChars', id] })
    },
  })
}
