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 clubsSlice from "./clubs/clubsSlice";
import club_membershipsSlice from "./club_memberships/club_membershipsSlice";
import playersSlice from "./players/playersSlice";
import seed_votesSlice from "./seed_votes/seed_votesSlice";
import venuesSlice from "./venues/venuesSlice";
import leaguesSlice from "./leagues/leaguesSlice";
import league_teamsSlice from "./league_teams/league_teamsSlice";
import league_team_playersSlice from "./league_team_players/league_team_playersSlice";
import gamesSlice from "./games/gamesSlice";
import game_rsvpsSlice from "./game_rsvps/game_rsvpsSlice";
import game_guestsSlice from "./game_guests/game_guestsSlice";
import game_teamsSlice from "./game_teams/game_teamsSlice";
import game_team_assignmentsSlice from "./game_team_assignments/game_team_assignmentsSlice";
import game_attendancesSlice from "./game_attendances/game_attendancesSlice";
import game_player_statsSlice from "./game_player_stats/game_player_statsSlice";
import game_paymentsSlice from "./game_payments/game_paymentsSlice";
import league_paymentsSlice from "./league_payments/league_paymentsSlice";
import league_standingsSlice from "./league_standings/league_standingsSlice";
import league_finish_awardsSlice from "./league_finish_awards/league_finish_awardsSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import audit_eventsSlice from "./audit_events/audit_eventsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
clubs: clubsSlice,
club_memberships: club_membershipsSlice,
players: playersSlice,
seed_votes: seed_votesSlice,
venues: venuesSlice,
leagues: leaguesSlice,
league_teams: league_teamsSlice,
league_team_players: league_team_playersSlice,
games: gamesSlice,
game_rsvps: game_rsvpsSlice,
game_guests: game_guestsSlice,
game_teams: game_teamsSlice,
game_team_assignments: game_team_assignmentsSlice,
game_attendances: game_attendancesSlice,
game_player_stats: game_player_statsSlice,
game_payments: game_paymentsSlice,
league_payments: league_paymentsSlice,
league_standings: league_standingsSlice,
league_finish_awards: league_finish_awardsSlice,
notifications: notificationsSlice,
audit_events: audit_eventsSlice,
  },
})

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