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

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