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 store_settingsSlice from "./store_settings/store_settingsSlice";
import categoriesSlice from "./categories/categoriesSlice";
import brandsSlice from "./brands/brandsSlice";
import productsSlice from "./products/productsSlice";
import product_variantsSlice from "./product_variants/product_variantsSlice";
import promo_codesSlice from "./promo_codes/promo_codesSlice";
import cartsSlice from "./carts/cartsSlice";
import cart_itemsSlice from "./cart_items/cart_itemsSlice";
import addressesSlice from "./addresses/addressesSlice";
import shipping_methodsSlice from "./shipping_methods/shipping_methodsSlice";
import ordersSlice from "./orders/ordersSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import payment_eventsSlice from "./payment_events/payment_eventsSlice";
import refundsSlice from "./refunds/refundsSlice";
import inventory_movementsSlice from "./inventory_movements/inventory_movementsSlice";
import product_reviewsSlice from "./product_reviews/product_reviewsSlice";
import wishlistsSlice from "./wishlists/wishlistsSlice";
import wishlist_itemsSlice from "./wishlist_items/wishlist_itemsSlice";
import cms_pagesSlice from "./cms_pages/cms_pagesSlice";
import homepage_sectionsSlice from "./homepage_sections/homepage_sectionsSlice";
import support_ticketsSlice from "./support_tickets/support_ticketsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
store_settings: store_settingsSlice,
categories: categoriesSlice,
brands: brandsSlice,
products: productsSlice,
product_variants: product_variantsSlice,
promo_codes: promo_codesSlice,
carts: cartsSlice,
cart_items: cart_itemsSlice,
addresses: addressesSlice,
shipping_methods: shipping_methodsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
payments: paymentsSlice,
payment_events: payment_eventsSlice,
refunds: refundsSlice,
inventory_movements: inventory_movementsSlice,
product_reviews: product_reviewsSlice,
wishlists: wishlistsSlice,
wishlist_items: wishlist_itemsSlice,
cms_pages: cms_pagesSlice,
homepage_sections: homepage_sectionsSlice,
support_tickets: support_ticketsSlice,
  },
})

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