import { configureStore } from "@reduxjs/toolkit";
import meetingDetailsOpenReducer from "./slices/meetingDetailsOpenSlice";
import favoritesReducer from "./slices/favoritesSlice";
import meetingsAndUserStatusReducer from "./slices/meetingsAndUserStatusSlice";
import usersReducer from "./slices/usersSlice";
import socketMiddleware from "./middleware/socketMiddleware";

export const store = configureStore({
  reducer: {
    meetingDetailsOpen: meetingDetailsOpenReducer,
    favorites: favoritesReducer,
    meetingsAndUserStatuses: meetingsAndUserStatusReducer,
    users: usersReducer,
  },
  middleware: (getDefaultMiddleware) => {
    return getDefaultMiddleware().concat([socketMiddleware]);
  },
});

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
