import { configureStore } from "@reduxjs/toolkit";
import { homepageApi } from "../services/homepageApi";
import { faqApi } from "../services/faqApi";
import { contactUsApi } from "../services/contactUsApi";
import { blogApi } from "../services/blogApi";
import { aboutUsApi } from "../services/aboutUsApi";
import { sercicesApi } from "../services/sercicesApi";
import { courseApi } from "../services/courseApi";
import { learningFacilityApi } from "../services/learningFacilityApi";
import { webinarApi } from "../services/webinarApi";

export const store = configureStore({
  reducer: {
    [homepageApi.reducerPath]: homepageApi.reducer,
    [faqApi.reducerPath]: faqApi.reducer,
    [contactUsApi.reducerPath]: contactUsApi.reducer,
    [blogApi.reducerPath]: blogApi.reducer,
    [aboutUsApi.reducerPath]: aboutUsApi.reducer,
    [sercicesApi.reducerPath]: sercicesApi.reducer,
    [courseApi.reducerPath]: courseApi.reducer,
    [learningFacilityApi.reducerPath]: learningFacilityApi.reducer,
    [webinarApi.reducerPath]: webinarApi.reducer,

  },
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(
      homepageApi.middleware,
      faqApi.middleware,
      contactUsApi.middleware,
      blogApi.middleware,
      aboutUsApi.middleware,
      sercicesApi.middleware,
      courseApi.middleware,
      learningFacilityApi.middleware,
      webinarApi.middleware,
    ),
});

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