import { configureStore } from '@reduxjs/toolkit';
import styleReducer from './styleSlice';
import mainReducer from './mainSlice';
import authSlice from './authSlice';
import openAiSlice from './openAiSlice';

import usersSlice from "./users/usersSlice";
import rolesSlice from "./roles/rolesSlice";
import permissionsSlice from "./permissions/permissionsSlice";
import companiesSlice from "./companies/companiesSlice";
import contactsSlice from "./contacts/contactsSlice";
import pipelinesSlice from "./pipelines/pipelinesSlice";
import pipeline_stagesSlice from "./pipeline_stages/pipeline_stagesSlice";
import leadsSlice from "./leads/leadsSlice";
import dealsSlice from "./deals/dealsSlice";
import activitiesSlice from "./activities/activitiesSlice";
import activity_filesSlice from "./activity_files/activity_filesSlice";
import deal_productsSlice from "./deal_products/deal_productsSlice";
import tagsSlice from "./tags/tagsSlice";
import lead_tagsSlice from "./lead_tags/lead_tagsSlice";
import deal_tagsSlice from "./deal_tags/deal_tagsSlice";

export const store = configureStore({
  reducer: {
    style: styleReducer,
    main: mainReducer,
    auth: authSlice,
    openAi: openAiSlice,

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
companies: companiesSlice,
contacts: contactsSlice,
pipelines: pipelinesSlice,
pipeline_stages: pipeline_stagesSlice,
leads: leadsSlice,
deals: dealsSlice,
activities: activitiesSlice,
activity_files: activity_filesSlice,
deal_products: deal_productsSlice,
tags: tagsSlice,
lead_tags: lead_tagsSlice,
deal_tags: deal_tagsSlice,
  },
})

// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch
