import { configureStore } from "@reduxjs/toolkit";
import { dashboard } from "./Service/apiSlice";
import authReducer from "./Service/authSlice";
import { deactivatedAccounts } from "./Service/deactivated.account.service";
import { faqs } from "./Service/faqs.service";
import { manageSubAdmin } from "./Service/manage.subadmin.service";
import { manageJobs } from "./Service/manage.jobs.service";
import { manageGroups } from "./Service/manage.groups.service";
import { manageContactUs } from "./Service/manage.contactus.service";
import { aboutUs } from "./Service/manage.aboutus.service";
import { privacyPolicy } from "./Service/privacy.policy.service";
import { privacy } from "./Service/privacy.service";
import { myProfile } from "./Service/myprofie.service";
import { agencyMasterModule } from "./Service/agency.master.module.service";
import { termsAndCondition } from "./Service/terms.and.condition.service";
import { templateMaster } from "./Service/template.master.service";
import { jobType } from "./Service/job.type.service";
import { industryMaster } from "./Service/industry.master.service";
import { profile } from "./Service/profile.password";
import { countryMaster } from "./Service/country.master";
import { departmentMaster } from "./Service/department.master";
import { workspaceMode } from "./Service/workspace.mode";
import { jobStatus } from "./Service/job.status";
import { managePosts } from "./Service/manage.post.service";
import { registerUser } from "./Service/manage.user";
import { dashBoard } from "./Service/dashBoard";

export const store = configureStore({
  reducer: {
    [dashboard.reducerPath]: dashboard.reducer,
    [deactivatedAccounts.reducerPath]: deactivatedAccounts.reducer,
    [faqs.reducerPath]: faqs.reducer,
    [manageSubAdmin.reducerPath]: manageSubAdmin.reducer,
    [manageJobs.reducerPath]: manageJobs.reducer,
    [manageGroups.reducerPath]: manageGroups.reducer,
    [manageContactUs.reducerPath]: manageContactUs.reducer,
    [aboutUs.reducerPath]: aboutUs.reducer,
    [privacyPolicy.reducerPath]: privacyPolicy.reducer,
    [privacy.reducerPath]: privacy.reducer,
    [myProfile.reducerPath]: myProfile.reducer,
    [agencyMasterModule.reducerPath]: agencyMasterModule.reducer,
    [termsAndCondition.reducerPath]: termsAndCondition.reducer,
    [templateMaster.reducerPath]: templateMaster.reducer,
    [jobType.reducerPath]: jobType.reducer,
    [industryMaster.reducerPath]: industryMaster.reducer,
    [profile.reducerPath]: profile.reducer,
    [countryMaster.reducerPath]: countryMaster.reducer,
    [departmentMaster.reducerPath]: departmentMaster.reducer,
    [workspaceMode.reducerPath]: workspaceMode.reducer,
    [jobStatus.reducerPath]: jobStatus.reducer,
    [managePosts.reducerPath]: managePosts.reducer,
    [registerUser.reducerPath]: registerUser.reducer,
    [dashBoard.reducerPath]: dashBoard.reducer,
    auth: authReducer,
  },
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware().concat(
      dashboard.middleware,
      deactivatedAccounts.middleware,
      faqs.middleware,
      manageSubAdmin.middleware,
      manageJobs.middleware,
      manageGroups.middleware,
      manageContactUs.middleware,
      aboutUs.middleware,
      privacyPolicy.middleware,
      privacy.middleware,
      myProfile.middleware,
      agencyMasterModule.middleware,
      termsAndCondition.middleware,
      templateMaster.middleware,
      jobType.middleware,
      industryMaster.middleware,
      profile.middleware,
      countryMaster.middleware,
      departmentMaster.middleware,
      workspaceMode.middleware,
      jobStatus.middleware,
      managePosts.middleware,
      registerUser.middleware,
      dashBoard.middleware,
    ),
});

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