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 workspacesSlice from "./workspaces/workspacesSlice";
import workspace_membershipsSlice from "./workspace_memberships/workspace_membershipsSlice";
import projectsSlice from "./projects/projectsSlice";
import mind_mapsSlice from "./mind_maps/mind_mapsSlice";
import map_nodesSlice from "./map_nodes/map_nodesSlice";
import map_edgesSlice from "./map_edges/map_edgesSlice";
import source_itemsSlice from "./source_items/source_itemsSlice";
import node_evidence_itemsSlice from "./node_evidence_items/node_evidence_itemsSlice";
import ai_runsSlice from "./ai_runs/ai_runsSlice";
import business_plan_versionsSlice from "./business_plan_versions/business_plan_versionsSlice";
import pitch_decksSlice from "./pitch_decks/pitch_decksSlice";
import deal_packagesSlice from "./deal_packages/deal_packagesSlice";
import partner_targetsSlice from "./partner_targets/partner_targetsSlice";
import tasksSlice from "./tasks/tasksSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
workspaces: workspacesSlice,
workspace_memberships: workspace_membershipsSlice,
projects: projectsSlice,
mind_maps: mind_mapsSlice,
map_nodes: map_nodesSlice,
map_edges: map_edgesSlice,
source_items: source_itemsSlice,
node_evidence_items: node_evidence_itemsSlice,
ai_runs: ai_runsSlice,
business_plan_versions: business_plan_versionsSlice,
pitch_decks: pitch_decksSlice,
deal_packages: deal_packagesSlice,
partner_targets: partner_targetsSlice,
tasks: tasksSlice,
  },
})

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