import { configureStore } from "@reduxjs/toolkit";
import { attractionsApi } from "./services/attractions.service";
import { citiesApi } from "./services/cities.service";
import { authApi } from "./services/auth.service";
import { profileApi } from "./services/profile.service";
import { cardsApi } from "./services/cards.service";

export const store = configureStore({
  reducer: {
    [attractionsApi.reducerPath]: attractionsApi.reducer,
    [citiesApi.reducerPath]: citiesApi.reducer,
    [authApi.reducerPath]: authApi.reducer,
    [profileApi.reducerPath]: profileApi.reducer,
    [cardsApi.reducerPath]:cardsApi.reducer

  },

  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(
      attractionsApi.middleware,
      citiesApi.middleware,
      authApi.middleware,
      profileApi.middleware,
      cardsApi.middleware
    ),
});
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;