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 companiesSlice from "./companies/companiesSlice";
import branchesSlice from "./branches/branchesSlice";
import vehicle_categoriesSlice from "./vehicle_categories/vehicle_categoriesSlice";
import vehiclesSlice from "./vehicles/vehiclesSlice";
import rate_plansSlice from "./rate_plans/rate_plansSlice";
import rate_rulesSlice from "./rate_rules/rate_rulesSlice";
import extrasSlice from "./extras/extrasSlice";
import insurance_plansSlice from "./insurance_plans/insurance_plansSlice";
import promo_codesSlice from "./promo_codes/promo_codesSlice";
import bookingsSlice from "./bookings/bookingsSlice";
import booking_extrasSlice from "./booking_extras/booking_extrasSlice";
import paymentsSlice from "./payments/paymentsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import messagesSlice from "./messages/messagesSlice";
import notification_templatesSlice from "./notification_templates/notification_templatesSlice";
import tasksSlice from "./tasks/tasksSlice";
import maintenance_recordsSlice from "./maintenance_records/maintenance_recordsSlice";
import customer_documentsSlice from "./customer_documents/customer_documentsSlice";
import audit_eventsSlice from "./audit_events/audit_eventsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
companies: companiesSlice,
branches: branchesSlice,
vehicle_categories: vehicle_categoriesSlice,
vehicles: vehiclesSlice,
rate_plans: rate_plansSlice,
rate_rules: rate_rulesSlice,
extras: extrasSlice,
insurance_plans: insurance_plansSlice,
promo_codes: promo_codesSlice,
bookings: bookingsSlice,
booking_extras: booking_extrasSlice,
payments: paymentsSlice,
invoices: invoicesSlice,
messages: messagesSlice,
notification_templates: notification_templatesSlice,
tasks: tasksSlice,
maintenance_records: maintenance_recordsSlice,
customer_documents: customer_documentsSlice,
audit_events: audit_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
