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 account_approvalsSlice from "./account_approvals/account_approvalsSlice";
import restaurantsSlice from "./restaurants/restaurantsSlice";
import restaurant_tablesSlice from "./restaurant_tables/restaurant_tablesSlice";
import work_schedulesSlice from "./work_schedules/work_schedulesSlice";
import work_shiftsSlice from "./work_shifts/work_shiftsSlice";
import attendance_eventsSlice from "./attendance_events/attendance_eventsSlice";
import geofence_alertsSlice from "./geofence_alerts/geofence_alertsSlice";
import menu_categoriesSlice from "./menu_categories/menu_categoriesSlice";
import menu_itemsSlice from "./menu_items/menu_itemsSlice";
import ordersSlice from "./orders/ordersSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import reservationsSlice from "./reservations/reservationsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import loyalty_accountsSlice from "./loyalty_accounts/loyalty_accountsSlice";
import loyalty_rulesSlice from "./loyalty_rules/loyalty_rulesSlice";
import loyalty_transactionsSlice from "./loyalty_transactions/loyalty_transactionsSlice";
import customer_reviewsSlice from "./customer_reviews/customer_reviewsSlice";
import notification_eventsSlice from "./notification_events/notification_eventsSlice";
import stock_locationsSlice from "./stock_locations/stock_locationsSlice";
import stock_itemsSlice from "./stock_items/stock_itemsSlice";
import stock_movementsSlice from "./stock_movements/stock_movementsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
account_approvals: account_approvalsSlice,
restaurants: restaurantsSlice,
restaurant_tables: restaurant_tablesSlice,
work_schedules: work_schedulesSlice,
work_shifts: work_shiftsSlice,
attendance_events: attendance_eventsSlice,
geofence_alerts: geofence_alertsSlice,
menu_categories: menu_categoriesSlice,
menu_items: menu_itemsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
reservations: reservationsSlice,
payments: paymentsSlice,
loyalty_accounts: loyalty_accountsSlice,
loyalty_rules: loyalty_rulesSlice,
loyalty_transactions: loyalty_transactionsSlice,
customer_reviews: customer_reviewsSlice,
notification_events: notification_eventsSlice,
stock_locations: stock_locationsSlice,
stock_items: stock_itemsSlice,
stock_movements: stock_movementsSlice,
invoices: invoicesSlice,
audit_logs: audit_logsSlice,
  },
})

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