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 osu_api_credentialsSlice from "./osu_api_credentials/osu_api_credentialsSlice";
import api_request_logsSlice from "./api_request_logs/api_request_logsSlice";
import sync_jobsSlice from "./sync_jobs/sync_jobsSlice";
import beatmap_setsSlice from "./beatmap_sets/beatmap_setsSlice";
import mappersSlice from "./mappers/mappersSlice";
import artistsSlice from "./artists/artistsSlice";
import beatmapsSlice from "./beatmaps/beatmapsSlice";
import mapper_statsSlice from "./mapper_stats/mapper_statsSlice";
import artist_statsSlice from "./artist_stats/artist_statsSlice";
import game_sessionsSlice from "./game_sessions/game_sessionsSlice";
import game_roundsSlice from "./game_rounds/game_roundsSlice";
import leaderboard_entriesSlice from "./leaderboard_entries/leaderboard_entriesSlice";
import daily_seedsSlice from "./daily_seeds/daily_seedsSlice";
import server_cachesSlice from "./server_caches/server_cachesSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
osu_api_credentials: osu_api_credentialsSlice,
api_request_logs: api_request_logsSlice,
sync_jobs: sync_jobsSlice,
beatmap_sets: beatmap_setsSlice,
mappers: mappersSlice,
artists: artistsSlice,
beatmaps: beatmapsSlice,
mapper_stats: mapper_statsSlice,
artist_stats: artist_statsSlice,
game_sessions: game_sessionsSlice,
game_rounds: game_roundsSlice,
leaderboard_entries: leaderboard_entriesSlice,
daily_seeds: daily_seedsSlice,
server_caches: server_cachesSlice,
  },
})

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