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 user_sessionsSlice from "./user_sessions/user_sessionsSlice";
import referralsSlice from "./referrals/referralsSlice";
import coin_earning_rulesSlice from "./coin_earning_rules/coin_earning_rulesSlice";
import coin_codesSlice from "./coin_codes/coin_codesSlice";
import coin_code_redemptionsSlice from "./coin_code_redemptions/coin_code_redemptionsSlice";
import wallet_transactionsSlice from "./wallet_transactions/wallet_transactionsSlice";
import coin_conversionsSlice from "./coin_conversions/coin_conversionsSlice";
import membership_plansSlice from "./membership_plans/membership_plansSlice";
import user_membershipsSlice from "./user_memberships/user_membershipsSlice";
import shop_itemsSlice from "./shop_items/shop_itemsSlice";
import item_redemptionsSlice from "./item_redemptions/item_redemptionsSlice";
import productsSlice from "./products/productsSlice";
import article_contentsSlice from "./article_contents/article_contentsSlice";
import comic_contentsSlice from "./comic_contents/comic_contentsSlice";
import video_contentsSlice from "./video_contents/video_contentsSlice";
import game_contentsSlice from "./game_contents/game_contentsSlice";
import product_purchasesSlice from "./product_purchases/product_purchasesSlice";
import content_consumptionsSlice from "./content_consumptions/content_consumptionsSlice";
import chat_roomsSlice from "./chat_rooms/chat_roomsSlice";
import chat_membershipsSlice from "./chat_memberships/chat_membershipsSlice";
import chat_messagesSlice from "./chat_messages/chat_messagesSlice";
import app_settingsSlice from "./app_settings/app_settingsSlice";
import admin_audit_logsSlice from "./admin_audit_logs/admin_audit_logsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
user_sessions: user_sessionsSlice,
referrals: referralsSlice,
coin_earning_rules: coin_earning_rulesSlice,
coin_codes: coin_codesSlice,
coin_code_redemptions: coin_code_redemptionsSlice,
wallet_transactions: wallet_transactionsSlice,
coin_conversions: coin_conversionsSlice,
membership_plans: membership_plansSlice,
user_memberships: user_membershipsSlice,
shop_items: shop_itemsSlice,
item_redemptions: item_redemptionsSlice,
products: productsSlice,
article_contents: article_contentsSlice,
comic_contents: comic_contentsSlice,
video_contents: video_contentsSlice,
game_contents: game_contentsSlice,
product_purchases: product_purchasesSlice,
content_consumptions: content_consumptionsSlice,
chat_rooms: chat_roomsSlice,
chat_memberships: chat_membershipsSlice,
chat_messages: chat_messagesSlice,
app_settings: app_settingsSlice,
admin_audit_logs: admin_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
