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 refresh_tokensSlice from "./refresh_tokens/refresh_tokensSlice";
import categoriesSlice from "./categories/categoriesSlice";
import locationsSlice from "./locations/locationsSlice";
import businessesSlice from "./businesses/businessesSlice";
import business_photosSlice from "./business_photos/business_photosSlice";
import business_categoriesSlice from "./business_categories/business_categoriesSlice";
import service_pricesSlice from "./service_prices/service_pricesSlice";
import business_badgesSlice from "./business_badges/business_badgesSlice";
import verification_submissionsSlice from "./verification_submissions/verification_submissionsSlice";
import verification_evidencesSlice from "./verification_evidences/verification_evidencesSlice";
import leadsSlice from "./leads/leadsSlice";
import lead_photosSlice from "./lead_photos/lead_photosSlice";
import lead_matchesSlice from "./lead_matches/lead_matchesSlice";
import messagesSlice from "./messages/messagesSlice";
import lead_eventsSlice from "./lead_events/lead_eventsSlice";
import reviewsSlice from "./reviews/reviewsSlice";
import disputesSlice from "./disputes/disputesSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import badge_rulesSlice from "./badge_rules/badge_rulesSlice";
import trust_adjustmentsSlice from "./trust_adjustments/trust_adjustmentsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
refresh_tokens: refresh_tokensSlice,
categories: categoriesSlice,
locations: locationsSlice,
businesses: businessesSlice,
business_photos: business_photosSlice,
business_categories: business_categoriesSlice,
service_prices: service_pricesSlice,
business_badges: business_badgesSlice,
verification_submissions: verification_submissionsSlice,
verification_evidences: verification_evidencesSlice,
leads: leadsSlice,
lead_photos: lead_photosSlice,
lead_matches: lead_matchesSlice,
messages: messagesSlice,
lead_events: lead_eventsSlice,
reviews: reviewsSlice,
disputes: disputesSlice,
audit_logs: audit_logsSlice,
badge_rules: badge_rulesSlice,
trust_adjustments: trust_adjustmentsSlice,
  },
})

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