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 publishersSlice from "./publishers/publishersSlice";
import authorsSlice from "./authors/authorsSlice";
import genresSlice from "./genres/genresSlice";
import booksSlice from "./books/booksSlice";
import user_library_itemsSlice from "./user_library_items/user_library_itemsSlice";
import bookmarksSlice from "./bookmarks/bookmarksSlice";
import notesSlice from "./notes/notesSlice";
import camera_scan_sessionsSlice from "./camera_scan_sessions/camera_scan_sessionsSlice";
import coin_ledger_entriesSlice from "./coin_ledger_entries/coin_ledger_entriesSlice";
import withdrawal_requestsSlice from "./withdrawal_requests/withdrawal_requestsSlice";
import payment_transactionsSlice from "./payment_transactions/payment_transactionsSlice";
import daily_login_rewardsSlice from "./daily_login_rewards/daily_login_rewardsSlice";
import reading_streaksSlice from "./reading_streaks/reading_streaksSlice";
import achievement_definitionsSlice from "./achievement_definitions/achievement_definitionsSlice";
import user_achievementsSlice from "./user_achievements/user_achievementsSlice";
import rank_tiersSlice from "./rank_tiers/rank_tiersSlice";
import user_ranksSlice from "./user_ranks/user_ranksSlice";
import challenge_definitionsSlice from "./challenge_definitions/challenge_definitionsSlice";
import user_challengesSlice from "./user_challenges/user_challengesSlice";
import quiz_definitionsSlice from "./quiz_definitions/quiz_definitionsSlice";
import quiz_questionsSlice from "./quiz_questions/quiz_questionsSlice";
import quiz_answer_choicesSlice from "./quiz_answer_choices/quiz_answer_choicesSlice";
import quiz_attemptsSlice from "./quiz_attempts/quiz_attemptsSlice";
import friendshipsSlice from "./friendships/friendshipsSlice";
import book_clubsSlice from "./book_clubs/book_clubsSlice";
import book_club_membershipsSlice from "./book_club_memberships/book_club_membershipsSlice";
import club_chat_messagesSlice from "./club_chat_messages/club_chat_messagesSlice";
import reading_circle_eventsSlice from "./reading_circle_events/reading_circle_eventsSlice";
import recommendation_eventsSlice from "./recommendation_events/recommendation_eventsSlice";
import push_notificationsSlice from "./push_notifications/push_notificationsSlice";
import fraud_flagsSlice from "./fraud_flags/fraud_flagsSlice";
import kyc_verificationsSlice from "./kyc_verifications/kyc_verificationsSlice";
import user_uploadsSlice from "./user_uploads/user_uploadsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
publishers: publishersSlice,
authors: authorsSlice,
genres: genresSlice,
books: booksSlice,
user_library_items: user_library_itemsSlice,
bookmarks: bookmarksSlice,
notes: notesSlice,
camera_scan_sessions: camera_scan_sessionsSlice,
coin_ledger_entries: coin_ledger_entriesSlice,
withdrawal_requests: withdrawal_requestsSlice,
payment_transactions: payment_transactionsSlice,
daily_login_rewards: daily_login_rewardsSlice,
reading_streaks: reading_streaksSlice,
achievement_definitions: achievement_definitionsSlice,
user_achievements: user_achievementsSlice,
rank_tiers: rank_tiersSlice,
user_ranks: user_ranksSlice,
challenge_definitions: challenge_definitionsSlice,
user_challenges: user_challengesSlice,
quiz_definitions: quiz_definitionsSlice,
quiz_questions: quiz_questionsSlice,
quiz_answer_choices: quiz_answer_choicesSlice,
quiz_attempts: quiz_attemptsSlice,
friendships: friendshipsSlice,
book_clubs: book_clubsSlice,
book_club_memberships: book_club_membershipsSlice,
club_chat_messages: club_chat_messagesSlice,
reading_circle_events: reading_circle_eventsSlice,
recommendation_events: recommendation_eventsSlice,
push_notifications: push_notificationsSlice,
fraud_flags: fraud_flagsSlice,
kyc_verifications: kyc_verificationsSlice,
user_uploads: user_uploadsSlice,
  },
})

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