import { useQuery } from '@tanstack/react-query'
import { listChargeableCharConfigs } from '../api/listChargeableCharConfigs'
import type { ChargeableCharConfigsQuery } from '../types'

export const chargeableCharConfigsQueryKey = (query: ChargeableCharConfigsQuery) =>
  ['chargeableChars', 'list', query] as const

export function useChargeableCharConfigs(query: ChargeableCharConfigsQuery) {
  return useQuery({
    queryKey: chargeableCharConfigsQueryKey(query),
    queryFn: () => listChargeableCharConfigs(query),
    staleTime: 30_000,
  })
}
