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 addressesSlice from "./addresses/addressesSlice";
import merchant_profilesSlice from "./merchant_profiles/merchant_profilesSlice";
import storesSlice from "./stores/storesSlice";
import courier_profilesSlice from "./courier_profiles/courier_profilesSlice";
import product_categoriesSlice from "./product_categories/product_categoriesSlice";
import productsSlice from "./products/productsSlice";
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 paymentsSlice from "./payments/paymentsSlice";
import deliveriesSlice from "./deliveries/deliveriesSlice";
import payoutsSlice from "./payouts/payoutsSlice";
import commissionsSlice from "./commissions/commissionsSlice";
import reviewsSlice from "./reviews/reviewsSlice";
import support_ticketsSlice from "./support_tickets/support_ticketsSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import languagesSlice from "./languages/languagesSlice";
import translation_keysSlice from "./translation_keys/translation_keysSlice";
import translationsSlice from "./translations/translationsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
addresses: addressesSlice,
merchant_profiles: merchant_profilesSlice,
stores: storesSlice,
courier_profiles: courier_profilesSlice,
product_categories: product_categoriesSlice,
products: productsSlice,
carts: cartsSlice,
cart_items: cart_itemsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
payments: paymentsSlice,
deliveries: deliveriesSlice,
payouts: payoutsSlice,
commissions: commissionsSlice,
reviews: reviewsSlice,
support_tickets: support_ticketsSlice,
notifications: notificationsSlice,
languages: languagesSlice,
translation_keys: translation_keysSlice,
translations: translationsSlice,
  },
})

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