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 projectsSlice from './projects/projectsSlice';
import project_membershipsSlice from './project_memberships/project_membershipsSlice';
import assetsSlice from './assets/assetsSlice';
import asset_variantsSlice from './asset_variants/asset_variantsSlice';
import presigned_url_requestsSlice from './presigned_url_requests/presigned_url_requestsSlice';
import tour_pagesSlice from './tour_pages/tour_pagesSlice';
import project_audio_tracksSlice from './project_audio_tracks/project_audio_tracksSlice';
import publish_eventsSlice from './publish_events/publish_eventsSlice';
import pwa_cachesSlice from './pwa_caches/pwa_cachesSlice';
import access_logsSlice from './access_logs/access_logsSlice';

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

    users: usersSlice,
    roles: rolesSlice,
    permissions: permissionsSlice,
    projects: projectsSlice,
    project_memberships: project_membershipsSlice,
    assets: assetsSlice,
    asset_variants: asset_variantsSlice,
    presigned_url_requests: presigned_url_requestsSlice,
    tour_pages: tour_pagesSlice,
    project_audio_tracks: project_audio_tracksSlice,
    publish_events: publish_eventsSlice,
    pwa_caches: pwa_cachesSlice,
    access_logs: access_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;
