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 organizationsSlice from "./organizations/organizationsSlice";
import workspacesSlice from "./workspaces/workspacesSlice";
import workspace_membershipsSlice from "./workspace_memberships/workspace_membershipsSlice";
import genresSlice from "./genres/genresSlice";
import languagesSlice from "./languages/languagesSlice";
import ai_modelsSlice from "./ai_models/ai_modelsSlice";
import projectsSlice from "./projects/projectsSlice";
import project_collaborationsSlice from "./project_collaborations/project_collaborationsSlice";
import songsSlice from "./songs/songsSlice";
import song_metadataSlice from "./song_metadata/song_metadataSlice";
import assetsSlice from "./assets/assetsSlice";
import recording_sessionsSlice from "./recording_sessions/recording_sessionsSlice";
import tracksSlice from "./tracks/tracksSlice";
import arrangement_sectionsSlice from "./arrangement_sections/arrangement_sectionsSlice";
import generation_requestsSlice from "./generation_requests/generation_requestsSlice";
import vocal_processing_presetsSlice from "./vocal_processing_presets/vocal_processing_presetsSlice";
import mastering_presetsSlice from "./mastering_presets/mastering_presetsSlice";
import mix_sessionsSlice from "./mix_sessions/mix_sessionsSlice";
import mastering_sessionsSlice from "./mastering_sessions/mastering_sessionsSlice";
import exportsSlice from "./exports/exportsSlice";
import cover_artworksSlice from "./cover_artworks/cover_artworksSlice";
import marketplace_listingsSlice from "./marketplace_listings/marketplace_listingsSlice";
import marketplace_ordersSlice from "./marketplace_orders/marketplace_ordersSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
workspaces: workspacesSlice,
workspace_memberships: workspace_membershipsSlice,
genres: genresSlice,
languages: languagesSlice,
ai_models: ai_modelsSlice,
projects: projectsSlice,
project_collaborations: project_collaborationsSlice,
songs: songsSlice,
song_metadata: song_metadataSlice,
assets: assetsSlice,
recording_sessions: recording_sessionsSlice,
tracks: tracksSlice,
arrangement_sections: arrangement_sectionsSlice,
generation_requests: generation_requestsSlice,
vocal_processing_presets: vocal_processing_presetsSlice,
mastering_presets: mastering_presetsSlice,
mix_sessions: mix_sessionsSlice,
mastering_sessions: mastering_sessionsSlice,
exports: exportsSlice,
cover_artworks: cover_artworksSlice,
marketplace_listings: marketplace_listingsSlice,
marketplace_orders: marketplace_ordersSlice,
  },
})

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