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 patientsSlice from "./patients/patientsSlice";
import guarantorsSlice from "./guarantors/guarantorsSlice";
import doctorsSlice from "./doctors/doctorsSlice";
import visitsSlice from "./visits/visitsSlice";
import ordersSlice from "./orders/ordersSlice";
import radiology_typesSlice from "./radiology_types/radiology_typesSlice";
import radiology_studiesSlice from "./radiology_studies/radiology_studiesSlice";
import ct_typesSlice from "./ct_types/ct_typesSlice";
import ct_studiesSlice from "./ct_studies/ct_studiesSlice";
import lab_testsSlice from "./lab_tests/lab_testsSlice";
import lab_ordersSlice from "./lab_orders/lab_ordersSlice";
import lab_resultsSlice from "./lab_results/lab_resultsSlice";
import endoscopy_casesSlice from "./endoscopy_cases/endoscopy_casesSlice";
import surgery_casesSlice from "./surgery_cases/surgery_casesSlice";
import surgery_consumablesSlice from "./surgery_consumables/surgery_consumablesSlice";
import anesthesia_recordsSlice from "./anesthesia_records/anesthesia_recordsSlice";
import cathlab_casesSlice from "./cathlab_cases/cathlab_casesSlice";
import ecg_stress_testsSlice from "./ecg_stress_tests/ecg_stress_testsSlice";
import nursing_staffSlice from "./nursing_staff/nursing_staffSlice";
import cleaning_staffSlice from "./cleaning_staff/cleaning_staffSlice";
import inventory_consumablesSlice from "./inventory_consumables/inventory_consumablesSlice";
import pharmacy_inventorySlice from "./pharmacy_inventory/pharmacy_inventorySlice";
import pharmacy_sales_invoicesSlice from "./pharmacy_sales_invoices/pharmacy_sales_invoicesSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import purchasesSlice from "./purchases/purchasesSlice";
import patient_invoicesSlice from "./patient_invoices/patient_invoicesSlice";
import ledger_entriesSlice from "./ledger_entries/ledger_entriesSlice";
import journal_entriesSlice from "./journal_entries/journal_entriesSlice";
import trial_balancesSlice from "./trial_balances/trial_balancesSlice";
import closing_balancesSlice from "./closing_balances/closing_balancesSlice";
import inpatient_roomsSlice from "./inpatient_rooms/inpatient_roomsSlice";
import room_bookingsSlice from "./room_bookings/room_bookingsSlice";
import restaurant_mealsSlice from "./restaurant_meals/restaurant_mealsSlice";
import restaurant_inventorySlice from "./restaurant_inventory/restaurant_inventorySlice";
import maternity_casesSlice from "./maternity_cases/maternity_casesSlice";
import pregnancy_followupsSlice from "./pregnancy_followups/pregnancy_followupsSlice";
import nicu_incubatorsSlice from "./nicu_incubators/nicu_incubatorsSlice";
import daily_followup_clinicSlice from "./daily_followup_clinic/daily_followup_clinicSlice";
import audit_logSlice from "./audit_log/audit_logSlice";
import settingsSlice from "./settings/settingsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
patients: patientsSlice,
guarantors: guarantorsSlice,
doctors: doctorsSlice,
visits: visitsSlice,
orders: ordersSlice,
radiology_types: radiology_typesSlice,
radiology_studies: radiology_studiesSlice,
ct_types: ct_typesSlice,
ct_studies: ct_studiesSlice,
lab_tests: lab_testsSlice,
lab_orders: lab_ordersSlice,
lab_results: lab_resultsSlice,
endoscopy_cases: endoscopy_casesSlice,
surgery_cases: surgery_casesSlice,
surgery_consumables: surgery_consumablesSlice,
anesthesia_records: anesthesia_recordsSlice,
cathlab_cases: cathlab_casesSlice,
ecg_stress_tests: ecg_stress_testsSlice,
nursing_staff: nursing_staffSlice,
cleaning_staff: cleaning_staffSlice,
inventory_consumables: inventory_consumablesSlice,
pharmacy_inventory: pharmacy_inventorySlice,
pharmacy_sales_invoices: pharmacy_sales_invoicesSlice,
suppliers: suppliersSlice,
purchases: purchasesSlice,
patient_invoices: patient_invoicesSlice,
ledger_entries: ledger_entriesSlice,
journal_entries: journal_entriesSlice,
trial_balances: trial_balancesSlice,
closing_balances: closing_balancesSlice,
inpatient_rooms: inpatient_roomsSlice,
room_bookings: room_bookingsSlice,
restaurant_meals: restaurant_mealsSlice,
restaurant_inventory: restaurant_inventorySlice,
maternity_cases: maternity_casesSlice,
pregnancy_followups: pregnancy_followupsSlice,
nicu_incubators: nicu_incubatorsSlice,
daily_followup_clinic: daily_followup_clinicSlice,
audit_log: audit_logSlice,
settings: settingsSlice,
  },
})

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