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 titlesSlice from "./titles/titlesSlice";
import genresSlice from "./genres/genresSlice";
import title_genresSlice from "./title_genres/title_genresSlice";
import peopleSlice from "./people/peopleSlice";
import title_castSlice from "./title_cast/title_castSlice";
import title_crewSlice from "./title_crew/title_crewSlice";
import videosSlice from "./videos/videosSlice";
import watchlistsSlice from "./watchlists/watchlistsSlice";
import watchlist_itemsSlice from "./watchlist_items/watchlist_itemsSlice";
import user_ratingsSlice from "./user_ratings/user_ratingsSlice";
import recommendationsSlice from "./recommendations/recommendationsSlice";
import trending_entriesSlice from "./trending_entries/trending_entriesSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
titles: titlesSlice,
genres: genresSlice,
title_genres: title_genresSlice,
people: peopleSlice,
title_cast: title_castSlice,
title_crew: title_crewSlice,
videos: videosSlice,
watchlists: watchlistsSlice,
watchlist_items: watchlist_itemsSlice,
user_ratings: user_ratingsSlice,
recommendations: recommendationsSlice,
trending_entries: trending_entriesSlice,
  },
})

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