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 customersSlice from "./customers/customersSlice";
import devicesSlice from "./devices/devicesSlice";
import repair_ordersSlice from "./repair_orders/repair_ordersSlice";
import repair_servicesSlice from "./repair_services/repair_servicesSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import payment_methodsSlice from "./payment_methods/payment_methodsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_itemsSlice from "./invoice_items/invoice_itemsSlice";
import whatsapp_notificationsSlice from "./whatsapp_notifications/whatsapp_notificationsSlice";
import ai_chat_sessionsSlice from "./ai_chat_sessions/ai_chat_sessionsSlice";
import ai_chat_messagesSlice from "./ai_chat_messages/ai_chat_messagesSlice";
import qr_linksSlice from "./qr_links/qr_linksSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
customers: customersSlice,
devices: devicesSlice,
repair_orders: repair_ordersSlice,
repair_services: repair_servicesSlice,
order_items: order_itemsSlice,
payment_methods: payment_methodsSlice,
payments: paymentsSlice,
invoices: invoicesSlice,
invoice_items: invoice_itemsSlice,
whatsapp_notifications: whatsapp_notificationsSlice,
ai_chat_sessions: ai_chat_sessionsSlice,
ai_chat_messages: ai_chat_messagesSlice,
qr_links: qr_linksSlice,
  },
})

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