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 subjectsSlice from "./subjects/subjectsSlice";
import topicsSlice from "./topics/topicsSlice";
import pagesSlice from "./pages/pagesSlice";
import blocksSlice from "./blocks/blocksSlice";
import databasesSlice from "./databases/databasesSlice";
import database_entriesSlice from "./database_entries/database_entriesSlice";
import sourcesSlice from "./sources/sourcesSlice";
import source_chunksSlice from "./source_chunks/source_chunksSlice";
import ai_jobsSlice from "./ai_jobs/ai_jobsSlice";
import concept_mapsSlice from "./concept_maps/concept_mapsSlice";
import study_guidesSlice from "./study_guides/study_guidesSlice";
import flashcard_decksSlice from "./flashcard_decks/flashcard_decksSlice";
import flashcardsSlice from "./flashcards/flashcardsSlice";
import spaced_repetition_statesSlice from "./spaced_repetition_states/spaced_repetition_statesSlice";
import study_sessionsSlice from "./study_sessions/study_sessionsSlice";
import review_eventsSlice from "./review_events/review_eventsSlice";
import quizzesSlice from "./quizzes/quizzesSlice";
import quiz_questionsSlice from "./quiz_questions/quiz_questionsSlice";
import quiz_attemptsSlice from "./quiz_attempts/quiz_attemptsSlice";
import tutor_conversationsSlice from "./tutor_conversations/tutor_conversationsSlice";
import tutor_messagesSlice from "./tutor_messages/tutor_messagesSlice";
import study_plansSlice from "./study_plans/study_plansSlice";
import study_plan_itemsSlice from "./study_plan_items/study_plan_itemsSlice";
import dashboard_snapshotsSlice from "./dashboard_snapshots/dashboard_snapshotsSlice";

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,
subjects: subjectsSlice,
topics: topicsSlice,
pages: pagesSlice,
blocks: blocksSlice,
databases: databasesSlice,
database_entries: database_entriesSlice,
sources: sourcesSlice,
source_chunks: source_chunksSlice,
ai_jobs: ai_jobsSlice,
concept_maps: concept_mapsSlice,
study_guides: study_guidesSlice,
flashcard_decks: flashcard_decksSlice,
flashcards: flashcardsSlice,
spaced_repetition_states: spaced_repetition_statesSlice,
study_sessions: study_sessionsSlice,
review_events: review_eventsSlice,
quizzes: quizzesSlice,
quiz_questions: quiz_questionsSlice,
quiz_attempts: quiz_attemptsSlice,
tutor_conversations: tutor_conversationsSlice,
tutor_messages: tutor_messagesSlice,
study_plans: study_plansSlice,
study_plan_items: study_plan_itemsSlice,
dashboard_snapshots: dashboard_snapshotsSlice,
  },
})

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