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 companiesSlice from "./companies/companiesSlice";
import company_membershipsSlice from "./company_memberships/company_membershipsSlice";
import branchesSlice from "./branches/branchesSlice";
import departmentsSlice from "./departments/departmentsSlice";
import compliance_categoriesSlice from "./compliance_categories/compliance_categoriesSlice";
import compliance_templatesSlice from "./compliance_templates/compliance_templatesSlice";
import company_compliancesSlice from "./company_compliances/company_compliancesSlice";
import tasksSlice from "./tasks/tasksSlice";
import documentsSlice from "./documents/documentsSlice";
import document_versionsSlice from "./document_versions/document_versionsSlice";
import alertsSlice from "./alerts/alertsSlice";
import calendar_eventsSlice from "./calendar_events/calendar_eventsSlice";
import subscription_plansSlice from "./subscription_plans/subscription_plansSlice";
import company_subscriptionsSlice from "./company_subscriptions/company_subscriptionsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import ai_chat_sessionsSlice from "./ai_chat_sessions/ai_chat_sessionsSlice";
import ai_chat_messagesSlice from "./ai_chat_messages/ai_chat_messagesSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import activity_eventsSlice from "./activity_events/activity_eventsSlice";
import report_exportsSlice from "./report_exports/report_exportsSlice";
import compliance_rule_overridesSlice from "./compliance_rule_overrides/compliance_rule_overridesSlice";
import integrationsSlice from "./integrations/integrationsSlice";
import notifications_preferencesSlice from "./notifications_preferences/notifications_preferencesSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
companies: companiesSlice,
company_memberships: company_membershipsSlice,
branches: branchesSlice,
departments: departmentsSlice,
compliance_categories: compliance_categoriesSlice,
compliance_templates: compliance_templatesSlice,
company_compliances: company_compliancesSlice,
tasks: tasksSlice,
documents: documentsSlice,
document_versions: document_versionsSlice,
alerts: alertsSlice,
calendar_events: calendar_eventsSlice,
subscription_plans: subscription_plansSlice,
company_subscriptions: company_subscriptionsSlice,
payments: paymentsSlice,
ai_chat_sessions: ai_chat_sessionsSlice,
ai_chat_messages: ai_chat_messagesSlice,
audit_logs: audit_logsSlice,
activity_events: activity_eventsSlice,
report_exports: report_exportsSlice,
compliance_rule_overrides: compliance_rule_overridesSlice,
integrations: integrationsSlice,
notifications_preferences: notifications_preferencesSlice,
  },
})

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