import { installPersistence } from '@platform-modules/query-react/persist'
import type { QueryClient } from '@tanstack/react-query'

export const OVERDECK_QUERY_PERSISTENCE = {
  keyPrefix: 'overdeck',
  buster: 'v1',
  userId: null,
} as const

export function installOverdeckQueryPersistence(queryClient: QueryClient): () => void {
  return installPersistence(queryClient, {
    userId: OVERDECK_QUERY_PERSISTENCE.userId,
    buster: OVERDECK_QUERY_PERSISTENCE.buster,
    keyPrefix: OVERDECK_QUERY_PERSISTENCE.keyPrefix,
    throttleMs: 1000,
  })
}
