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 pagesSlice from "./pages/pagesSlice";
import categoriesSlice from "./categories/categoriesSlice";
import brandsSlice from "./brands/brandsSlice";
import productsSlice from "./products/productsSlice";
import product_variantsSlice from "./product_variants/product_variantsSlice";
import variant_optionsSlice from "./variant_options/variant_optionsSlice";
import product_reviewsSlice from "./product_reviews/product_reviewsSlice";
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 addressesSlice from "./addresses/addressesSlice";
import order_addressesSlice from "./order_addresses/order_addressesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import shipmentsSlice from "./shipments/shipmentsSlice";
import couponsSlice from "./coupons/couponsSlice";
import coupon_redemptionsSlice from "./coupon_redemptions/coupon_redemptionsSlice";
import wishlist_itemsSlice from "./wishlist_items/wishlist_itemsSlice";
import home_sectionsSlice from "./home_sections/home_sectionsSlice";
import home_section_itemsSlice from "./home_section_items/home_section_itemsSlice";
import contact_messagesSlice from "./contact_messages/contact_messagesSlice";
import media_assetsSlice from "./media_assets/media_assetsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
store_settings: store_settingsSlice,
pages: pagesSlice,
categories: categoriesSlice,
brands: brandsSlice,
products: productsSlice,
product_variants: product_variantsSlice,
variant_options: variant_optionsSlice,
product_reviews: product_reviewsSlice,
carts: cartsSlice,
cart_items: cart_itemsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
addresses: addressesSlice,
order_addresses: order_addressesSlice,
payments: paymentsSlice,
shipments: shipmentsSlice,
coupons: couponsSlice,
coupon_redemptions: coupon_redemptionsSlice,
wishlist_items: wishlist_itemsSlice,
home_sections: home_sectionsSlice,
home_section_items: home_section_itemsSlice,
contact_messages: contact_messagesSlice,
media_assets: media_assetsSlice,
audit_logs: audit_logsSlice,
  },
})

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