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 activity_logsSlice from './activity_logs/activity_logsSlice';
import assignment_submissionsSlice from './assignment_submissions/assignment_submissionsSlice';
import assignmentsSlice from './assignments/assignmentsSlice';
import billsSlice from './bills/billsSlice';
import class_messagesSlice from './class_messages/class_messagesSlice';
import class_subjectsSlice from './class_subjects/class_subjectsSlice';
import classesSlice from './classes/classesSlice';
import exam_subjectsSlice from './exam_subjects/exam_subjectsSlice';
import examsSlice from './exams/examsSlice';
import fee_paymentsSlice from './fee_payments/fee_paymentsSlice';
import fee_structuresSlice from './fee_structures/fee_structuresSlice';
import lesson_plansSlice from './lesson_plans/lesson_plansSlice';
import login_logsSlice from './login_logs/login_logsSlice';
import marksSlice from './marks/marksSlice';
import messagesSlice from './messages/messagesSlice';
import parentsSlice from './parents/parentsSlice';
import period_settingsSlice from './period_settings/period_settingsSlice';
import school_adminsSlice from './school_admins/school_adminsSlice';
import student_attendanceSlice from './student_attendance/student_attendanceSlice';
import studentsSlice from './students/studentsSlice';
import subjectsSlice from './subjects/subjectsSlice';
import teacher_attendanceSlice from './teacher_attendance/teacher_attendanceSlice';
import teachersSlice from './teachers/teachersSlice';
import timetablesSlice from './timetables/timetablesSlice';
import rolesSlice from './roles/rolesSlice';
import permissionsSlice from './permissions/permissionsSlice';
import schoolsSlice from './schools/schoolsSlice';

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

    users: usersSlice,
    activity_logs: activity_logsSlice,
    assignment_submissions: assignment_submissionsSlice,
    assignments: assignmentsSlice,
    bills: billsSlice,
    class_messages: class_messagesSlice,
    class_subjects: class_subjectsSlice,
    classes: classesSlice,
    exam_subjects: exam_subjectsSlice,
    exams: examsSlice,
    fee_payments: fee_paymentsSlice,
    fee_structures: fee_structuresSlice,
    lesson_plans: lesson_plansSlice,
    login_logs: login_logsSlice,
    marks: marksSlice,
    messages: messagesSlice,
    parents: parentsSlice,
    period_settings: period_settingsSlice,
    school_admins: school_adminsSlice,
    student_attendance: student_attendanceSlice,
    students: studentsSlice,
    subjects: subjectsSlice,
    teacher_attendance: teacher_attendanceSlice,
    teachers: teachersSlice,
    timetables: timetablesSlice,
    roles: rolesSlice,
    permissions: permissionsSlice,
    schools: schoolsSlice,
  },
});

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