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 analytics_dailySlice from './analytics_daily/analytics_dailySlice';
import analytics_eventsSlice from './analytics_events/analytics_eventsSlice';
import audit_logsSlice from './audit_logs/audit_logsSlice';
import blocksSlice from './blocks/blocksSlice';
import button_linksSlice from './button_links/button_linksSlice';
import domain_mappingsSlice from './domain_mappings/domain_mappingsSlice';
import email_logsSlice from './email_logs/email_logsSlice';
import feature_flagsSlice from './feature_flags/feature_flagsSlice';
import flagsSlice from './flags/flagsSlice';
import media_assetsSlice from './media_assets/media_assetsSlice';
import payment_transactionsSlice from './payment_transactions/payment_transactionsSlice';
import plansSlice from './plans/plansSlice';
import profile_pagesSlice from './profile_pages/profile_pagesSlice';
import social_linksSlice from './social_links/social_linksSlice';
import subscriptionsSlice from './subscriptions/subscriptionsSlice';
import templatesSlice from './templates/templatesSlice';
import rolesSlice from './roles/rolesSlice';
import permissionsSlice from './permissions/permissionsSlice';
import organizationsSlice from './organizations/organizationsSlice';

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

    users: usersSlice,
    analytics_daily: analytics_dailySlice,
    analytics_events: analytics_eventsSlice,
    audit_logs: audit_logsSlice,
    blocks: blocksSlice,
    button_links: button_linksSlice,
    domain_mappings: domain_mappingsSlice,
    email_logs: email_logsSlice,
    feature_flags: feature_flagsSlice,
    flags: flagsSlice,
    media_assets: media_assetsSlice,
    payment_transactions: payment_transactionsSlice,
    plans: plansSlice,
    profile_pages: profile_pagesSlice,
    social_links: social_linksSlice,
    subscriptions: subscriptionsSlice,
    templates: templatesSlice,
    roles: rolesSlice,
    permissions: permissionsSlice,
    organizations: organizationsSlice,
  },
});

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