import reducerFromMap from "@racletteCore/lib/reducerFromMap"
import { applicationState } from "@racletteCore/store/state"
import * as reducers from "./reducers"

const reducerMap = {
  init: () => applicationState.queriesCache || {},
  "queriesCache/add": reducers.cacheAdd,
  "queriesCache/remove": reducers.cacheRemove,
  "queries/updateItems": reducers.cacheCheck,
  "queries/remove": reducers.cacheChildRemove,
}

const queriesCacheReducers = reducerFromMap(reducerMap)

export { queriesCacheReducers }
