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 subjectsSlice from "./subjects/subjectsSlice";
import grade_levelsSlice from "./grade_levels/grade_levelsSlice";
import textbooksSlice from "./textbooks/textbooksSlice";
import chaptersSlice from "./chapters/chaptersSlice";
import curriculum_standardsSlice from "./curriculum_standards/curriculum_standardsSlice";
import skillsSlice from "./skills/skillsSlice";
import question_banksSlice from "./question_banks/question_banksSlice";
import questionsSlice from "./questions/questionsSlice";
import answer_choicesSlice from "./answer_choices/answer_choicesSlice";
import testsSlice from "./tests/testsSlice";
import test_sectionsSlice from "./test_sections/test_sectionsSlice";
import test_itemsSlice from "./test_items/test_itemsSlice";
import test_versionsSlice from "./test_versions/test_versionsSlice";
import version_itemsSlice from "./version_items/version_itemsSlice";
import version_answer_ordersSlice from "./version_answer_orders/version_answer_ordersSlice";
import exportsSlice from "./exports/exportsSlice";
import answer_keysSlice from "./answer_keys/answer_keysSlice";
import scoring_schemesSlice from "./scoring_schemes/scoring_schemesSlice";
import test_matricesSlice from "./test_matrices/test_matricesSlice";
import matrix_rowsSlice from "./matrix_rows/matrix_rowsSlice";
import collectionsSlice from "./collections/collectionsSlice";
import ai_generation_jobsSlice from "./ai_generation_jobs/ai_generation_jobsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
subjects: subjectsSlice,
grade_levels: grade_levelsSlice,
textbooks: textbooksSlice,
chapters: chaptersSlice,
curriculum_standards: curriculum_standardsSlice,
skills: skillsSlice,
question_banks: question_banksSlice,
questions: questionsSlice,
answer_choices: answer_choicesSlice,
tests: testsSlice,
test_sections: test_sectionsSlice,
test_items: test_itemsSlice,
test_versions: test_versionsSlice,
version_items: version_itemsSlice,
version_answer_orders: version_answer_ordersSlice,
exports: exportsSlice,
answer_keys: answer_keysSlice,
scoring_schemes: scoring_schemesSlice,
test_matrices: test_matricesSlice,
matrix_rows: matrix_rowsSlice,
collections: collectionsSlice,
ai_generation_jobs: ai_generation_jobsSlice,
  },
})

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