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 campusesSlice from "./campuses/campusesSlice";
import academic_yearsSlice from "./academic_years/academic_yearsSlice";
import gradesSlice from "./grades/gradesSlice";
import subjectsSlice from "./subjects/subjectsSlice";
import studentsSlice from "./students/studentsSlice";
import guardiansSlice from "./guardians/guardiansSlice";
import staffSlice from "./staff/staffSlice";
import classesSlice from "./classes/classesSlice";
import class_enrollmentsSlice from "./class_enrollments/class_enrollmentsSlice";
import class_subjectsSlice from "./class_subjects/class_subjectsSlice";
import timetablesSlice from "./timetables/timetablesSlice";
import timetable_periodsSlice from "./timetable_periods/timetable_periodsSlice";
import attendance_sessionsSlice from "./attendance_sessions/attendance_sessionsSlice";
import attendance_recordsSlice from "./attendance_records/attendance_recordsSlice";
import fee_plansSlice from "./fee_plans/fee_plansSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import assessmentsSlice from "./assessments/assessmentsSlice";
import assessment_resultsSlice from "./assessment_results/assessment_resultsSlice";
import messagesSlice from "./messages/messagesSlice";
import message_recipientsSlice from "./message_recipients/message_recipientsSlice";
import documentsSlice from "./documents/documentsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
campuses: campusesSlice,
academic_years: academic_yearsSlice,
grades: gradesSlice,
subjects: subjectsSlice,
students: studentsSlice,
guardians: guardiansSlice,
staff: staffSlice,
classes: classesSlice,
class_enrollments: class_enrollmentsSlice,
class_subjects: class_subjectsSlice,
timetables: timetablesSlice,
timetable_periods: timetable_periodsSlice,
attendance_sessions: attendance_sessionsSlice,
attendance_records: attendance_recordsSlice,
fee_plans: fee_plansSlice,
invoices: invoicesSlice,
payments: paymentsSlice,
assessments: assessmentsSlice,
assessment_results: assessment_resultsSlice,
messages: messagesSlice,
message_recipients: message_recipientsSlice,
documents: documentsSlice,
  },
})

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