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 storesSlice from "./stores/storesSlice";
import productsSlice from "./products/productsSlice";
import brandsSlice from "./brands/brandsSlice";
import categoriesSlice from "./categories/categoriesSlice";
import customersSlice from "./customers/customersSlice";
import price_listsSlice from "./price_lists/price_listsSlice";
import price_list_itemsSlice from "./price_list_items/price_list_itemsSlice";
import discountsSlice from "./discounts/discountsSlice";
import registersSlice from "./registers/registersSlice";
import cash_drawer_sessionsSlice from "./cash_drawer_sessions/cash_drawer_sessionsSlice";
import salesSlice from "./sales/salesSlice";
import sale_itemsSlice from "./sale_items/sale_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import returnsSlice from "./returns/returnsSlice";
import return_itemsSlice from "./return_items/return_itemsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_itemsSlice from "./purchase_order_items/purchase_order_itemsSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import stock_movementsSlice from "./stock_movements/stock_movementsSlice";
import stock_transfersSlice from "./stock_transfers/stock_transfersSlice";
import stock_transfer_itemsSlice from "./stock_transfer_items/stock_transfer_itemsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
stores: storesSlice,
products: productsSlice,
brands: brandsSlice,
categories: categoriesSlice,
customers: customersSlice,
price_lists: price_listsSlice,
price_list_items: price_list_itemsSlice,
discounts: discountsSlice,
registers: registersSlice,
cash_drawer_sessions: cash_drawer_sessionsSlice,
sales: salesSlice,
sale_items: sale_itemsSlice,
payments: paymentsSlice,
returns: returnsSlice,
return_items: return_itemsSlice,
suppliers: suppliersSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_items: purchase_order_itemsSlice,
inventory_items: inventory_itemsSlice,
stock_movements: stock_movementsSlice,
stock_transfers: stock_transfersSlice,
stock_transfer_items: stock_transfer_itemsSlice,
  },
})

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