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

const reducerMap = {
  init: () => applicationState.queries,
  "queries/execute": reducers.queriesExecute,
  "queries/add": reducers.queriesAdd,
  "queries/add/execute": reducers.queriesAdd,
  "queries/remove": reducers.queriesRemove,
  "queries/updateItems": reducers.updateQueryItems,
  "queries/update": reducers.updateQuery,
  "queries/update/loading": reducers.queriesUpdateLoading,
  "queries/setCacheKey": reducers.queryiesSetCacheKey,
}

const queriesReducers = reducerFromMap(reducerMap)

export { queriesEffects, queriesReducers }
