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 organizationsSlice from "./organizations/organizationsSlice";
import tenantsSlice from "./tenants/tenantsSlice";
import role_permissionsSlice from "./role_permissions/role_permissionsSlice";
import pipelinesSlice from "./pipelines/pipelinesSlice";
import deal_stagesSlice from "./deal_stages/deal_stagesSlice";
import companiesSlice from "./companies/companiesSlice";
import contactsSlice from "./contacts/contactsSlice";
import leadsSlice from "./leads/leadsSlice";
import dealsSlice from "./deals/dealsSlice";
import activitiesSlice from "./activities/activitiesSlice";
import tasksSlice from "./tasks/tasksSlice";
import remindersSlice from "./reminders/remindersSlice";
import email_templatesSlice from "./email_templates/email_templatesSlice";
import email_notificationsSlice from "./email_notifications/email_notificationsSlice";
import importsSlice from "./imports/importsSlice";
import exportsSlice from "./exports/exportsSlice";
import api_clientsSlice from "./api_clients/api_clientsSlice";
import api_tokensSlice from "./api_tokens/api_tokensSlice";
import webhooksSlice from "./webhooks/webhooksSlice";
import webhook_deliveriesSlice from "./webhook_deliveries/webhook_deliveriesSlice";
import integrationsSlice from "./integrations/integrationsSlice";
import calendar_accountsSlice from "./calendar_accounts/calendar_accountsSlice";
import calendar_eventsSlice from "./calendar_events/calendar_eventsSlice";
import dashboard_widgetsSlice from "./dashboard_widgets/dashboard_widgetsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
role_permissions: role_permissionsSlice,
pipelines: pipelinesSlice,
deal_stages: deal_stagesSlice,
companies: companiesSlice,
contacts: contactsSlice,
leads: leadsSlice,
deals: dealsSlice,
activities: activitiesSlice,
tasks: tasksSlice,
reminders: remindersSlice,
email_templates: email_templatesSlice,
email_notifications: email_notificationsSlice,
imports: importsSlice,
exports: exportsSlice,
api_clients: api_clientsSlice,
api_tokens: api_tokensSlice,
webhooks: webhooksSlice,
webhook_deliveries: webhook_deliveriesSlice,
integrations: integrationsSlice,
calendar_accounts: calendar_accountsSlice,
calendar_events: calendar_eventsSlice,
dashboard_widgets: dashboard_widgetsSlice,
  },
})

// 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
