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 pagesSlice from "./pages/pagesSlice";
import collectionsSlice from "./collections/collectionsSlice";
import productsSlice from "./products/productsSlice";
import product_variantsSlice from "./product_variants/product_variantsSlice";
import customersSlice from "./customers/customersSlice";
import addressesSlice from "./addresses/addressesSlice";
import ordersSlice from "./orders/ordersSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import fulfillmentsSlice from "./fulfillments/fulfillmentsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import discount_codesSlice from "./discount_codes/discount_codesSlice";
import refundsSlice from "./refunds/refundsSlice";
import inventory_adjustmentsSlice from "./inventory_adjustments/inventory_adjustmentsSlice";
import faq_articlesSlice from "./faq_articles/faq_articlesSlice";
import chatbot_configsSlice from "./chatbot_configs/chatbot_configsSlice";
import chat_sessionsSlice from "./chat_sessions/chat_sessionsSlice";
import chat_messagesSlice from "./chat_messages/chat_messagesSlice";
import support_ticketsSlice from "./support_tickets/support_ticketsSlice";
import shopify_sync_jobsSlice from "./shopify_sync_jobs/shopify_sync_jobsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
stores: storesSlice,
pages: pagesSlice,
collections: collectionsSlice,
products: productsSlice,
product_variants: product_variantsSlice,
customers: customersSlice,
addresses: addressesSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
fulfillments: fulfillmentsSlice,
payments: paymentsSlice,
discount_codes: discount_codesSlice,
refunds: refundsSlice,
inventory_adjustments: inventory_adjustmentsSlice,
faq_articles: faq_articlesSlice,
chatbot_configs: chatbot_configsSlice,
chat_sessions: chat_sessionsSlice,
chat_messages: chat_messagesSlice,
support_tickets: support_ticketsSlice,
shopify_sync_jobs: shopify_sync_jobsSlice,
  },
})

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