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 accountsSlice from "./accounts/accountsSlice";
import locationsSlice from "./locations/locationsSlice";
import contactsSlice from "./contacts/contactsSlice";
import product_categoriesSlice from "./product_categories/product_categoriesSlice";
import productsSlice from "./products/productsSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import price_listsSlice from "./price_lists/price_listsSlice";
import price_list_itemsSlice from "./price_list_items/price_list_itemsSlice";
import account_price_listsSlice from "./account_price_lists/account_price_listsSlice";
import cartsSlice from "./carts/cartsSlice";
import cart_itemsSlice from "./cart_items/cart_itemsSlice";
import ordersSlice from "./orders/ordersSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import shipmentsSlice from "./shipments/shipmentsSlice";
import quotesSlice from "./quotes/quotesSlice";
import quote_itemsSlice from "./quote_items/quote_itemsSlice";
import sample_requestsSlice from "./sample_requests/sample_requestsSlice";
import saved_listsSlice from "./saved_lists/saved_listsSlice";
import saved_list_itemsSlice from "./saved_list_items/saved_list_itemsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
accounts: accountsSlice,
locations: locationsSlice,
contacts: contactsSlice,
product_categories: product_categoriesSlice,
products: productsSlice,
inventory_items: inventory_itemsSlice,
price_lists: price_listsSlice,
price_list_items: price_list_itemsSlice,
account_price_lists: account_price_listsSlice,
carts: cartsSlice,
cart_items: cart_itemsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
shipments: shipmentsSlice,
quotes: quotesSlice,
quote_items: quote_itemsSlice,
sample_requests: sample_requestsSlice,
saved_lists: saved_listsSlice,
saved_list_items: saved_list_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
