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 projectsSlice from "./projects/projectsSlice";
import project_phasesSlice from "./project_phases/project_phasesSlice";
import milestonesSlice from "./milestones/milestonesSlice";
import ore_bodiesSlice from "./ore_bodies/ore_bodiesSlice";
import samplesSlice from "./samples/samplesSlice";
import chain_of_custody_eventsSlice from "./chain_of_custody_events/chain_of_custody_eventsSlice";
import laboratoriesSlice from "./laboratories/laboratoriesSlice";
import test_type_schemasSlice from "./test_type_schemas/test_type_schemasSlice";
import metallurgical_testsSlice from "./metallurgical_tests/metallurgical_testsSlice";
import test_result_pointsSlice from "./test_result_points/test_result_pointsSlice";
import flowsheetsSlice from "./flowsheets/flowsheetsSlice";
import equipment_itemsSlice from "./equipment_items/equipment_itemsSlice";
import flowsheet_nodesSlice from "./flowsheet_nodes/flowsheet_nodesSlice";
import flowsheet_streamsSlice from "./flowsheet_streams/flowsheet_streamsSlice";
import design_criteria_itemsSlice from "./design_criteria_items/design_criteria_itemsSlice";
import economic_modelsSlice from "./economic_models/economic_modelsSlice";
import capex_itemsSlice from "./capex_items/capex_itemsSlice";
import opex_itemsSlice from "./opex_items/opex_itemsSlice";
import monte_carlo_runsSlice from "./monte_carlo_runs/monte_carlo_runsSlice";
import documentsSlice from "./documents/documentsSlice";
import entity_linksSlice from "./entity_links/entity_linksSlice";
import commentsSlice from "./comments/commentsSlice";
import tasksSlice from "./tasks/tasksSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import integrationsSlice from "./integrations/integrationsSlice";
import offline_sync_batchesSlice from "./offline_sync_batches/offline_sync_batchesSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
projects: projectsSlice,
project_phases: project_phasesSlice,
milestones: milestonesSlice,
ore_bodies: ore_bodiesSlice,
samples: samplesSlice,
chain_of_custody_events: chain_of_custody_eventsSlice,
laboratories: laboratoriesSlice,
test_type_schemas: test_type_schemasSlice,
metallurgical_tests: metallurgical_testsSlice,
test_result_points: test_result_pointsSlice,
flowsheets: flowsheetsSlice,
equipment_items: equipment_itemsSlice,
flowsheet_nodes: flowsheet_nodesSlice,
flowsheet_streams: flowsheet_streamsSlice,
design_criteria_items: design_criteria_itemsSlice,
economic_models: economic_modelsSlice,
capex_items: capex_itemsSlice,
opex_items: opex_itemsSlice,
monte_carlo_runs: monte_carlo_runsSlice,
documents: documentsSlice,
entity_links: entity_linksSlice,
comments: commentsSlice,
tasks: tasksSlice,
notifications: notificationsSlice,
audit_logs: audit_logsSlice,
integrations: integrationsSlice,
offline_sync_batches: offline_sync_batchesSlice,
  },
})

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