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 schoolsSlice from "./schools/schoolsSlice";
import campusesSlice from "./campuses/campusesSlice";
import academic_yearsSlice from "./academic_years/academic_yearsSlice";
import termsSlice from "./terms/termsSlice";
import grade_levelsSlice from "./grade_levels/grade_levelsSlice";
import subjectsSlice from "./subjects/subjectsSlice";
import roomsSlice from "./rooms/roomsSlice";
import studentsSlice from "./students/studentsSlice";
import parentsSlice from "./parents/parentsSlice";
import student_parent_linksSlice from "./student_parent_links/student_parent_linksSlice";
import teachersSlice from "./teachers/teachersSlice";
import classesSlice from "./classes/classesSlice";
import class_enrollmentsSlice from "./class_enrollments/class_enrollmentsSlice";
import course_sectionsSlice from "./course_sections/course_sectionsSlice";
import timetable_entriesSlice from "./timetable_entries/timetable_entriesSlice";
import attendance_sessionsSlice from "./attendance_sessions/attendance_sessionsSlice";
import attendance_recordsSlice from "./attendance_records/attendance_recordsSlice";
import assignmentsSlice from "./assignments/assignmentsSlice";
import submissionsSlice from "./submissions/submissionsSlice";
import grade_itemsSlice from "./grade_items/grade_itemsSlice";
import grade_recordsSlice from "./grade_records/grade_recordsSlice";
import announcementsSlice from "./announcements/announcementsSlice";
import messagesSlice from "./messages/messagesSlice";
import message_recipientsSlice from "./message_recipients/message_recipientsSlice";
import eventsSlice from "./events/eventsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
schools: schoolsSlice,
campuses: campusesSlice,
academic_years: academic_yearsSlice,
terms: termsSlice,
grade_levels: grade_levelsSlice,
subjects: subjectsSlice,
rooms: roomsSlice,
students: studentsSlice,
parents: parentsSlice,
student_parent_links: student_parent_linksSlice,
teachers: teachersSlice,
classes: classesSlice,
class_enrollments: class_enrollmentsSlice,
course_sections: course_sectionsSlice,
timetable_entries: timetable_entriesSlice,
attendance_sessions: attendance_sessionsSlice,
attendance_records: attendance_recordsSlice,
assignments: assignmentsSlice,
submissions: submissionsSlice,
grade_items: grade_itemsSlice,
grade_records: grade_recordsSlice,
announcements: announcementsSlice,
messages: messagesSlice,
message_recipients: message_recipientsSlice,
events: eventsSlice,
  },
})

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