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 accountsSlice from './accounts/accountsSlice';
import announcementsSlice from './announcements/announcementsSlice';
import barter_offersSlice from './barter_offers/barter_offersSlice';
import delayed_paymentsSlice from './delayed_payments/delayed_paymentsSlice';
import islamic_finance_librarySlice from './islamic_finance_library/islamic_finance_librarySlice';
import loan_applicationsSlice from './loan_applications/loan_applicationsSlice';
import partnersSlice from './partners/partnersSlice';
import projectsSlice from './projects/projectsSlice';
import transactionsSlice from './transactions/transactionsSlice';
import rolesSlice from './roles/rolesSlice';
import permissionsSlice from './permissions/permissionsSlice';
import kooperatifSlice from './kooperatif/kooperatifSlice';

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

    users: usersSlice,
    accounts: accountsSlice,
    announcements: announcementsSlice,
    barter_offers: barter_offersSlice,
    delayed_payments: delayed_paymentsSlice,
    islamic_finance_library: islamic_finance_librarySlice,
    loan_applications: loan_applicationsSlice,
    partners: partnersSlice,
    projects: projectsSlice,
    transactions: transactionsSlice,
    roles: rolesSlice,
    permissions: permissionsSlice,
    kooperatif: kooperatifSlice,
  },
});

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