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 tenantsSlice from "./tenants/tenantsSlice";
import locationsSlice from "./locations/locationsSlice";
import role_permissionsSlice from "./role_permissions/role_permissionsSlice";
import tenant_membershipsSlice from "./tenant_memberships/tenant_membershipsSlice";
import customersSlice from "./customers/customersSlice";
import productsSlice from "./products/productsSlice";
import product_variantsSlice from "./product_variants/product_variantsSlice";
import tax_ratesSlice from "./tax_rates/tax_ratesSlice";
import discountsSlice from "./discounts/discountsSlice";
import registersSlice from "./registers/registersSlice";
import shiftsSlice from "./shifts/shiftsSlice";
import cartsSlice from "./carts/cartsSlice";
import cart_itemsSlice from "./cart_items/cart_itemsSlice";
import ordersSlice from "./orders/ordersSlice";
import order_itemsSlice from "./order_items/order_itemsSlice";
import payment_intentsSlice from "./payment_intents/payment_intentsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import refundsSlice from "./refunds/refundsSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import inventory_adjustmentsSlice from "./inventory_adjustments/inventory_adjustmentsSlice";
import partnersSlice from "./partners/partnersSlice";
import tenant_partnershipsSlice from "./tenant_partnerships/tenant_partnershipsSlice";
import payoutsSlice from "./payouts/payoutsSlice";
import helcim_configurationsSlice from "./helcim_configurations/helcim_configurationsSlice";
import reportsSlice from "./reports/reportsSlice";
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,
tenants: tenantsSlice,
locations: locationsSlice,
role_permissions: role_permissionsSlice,
tenant_memberships: tenant_membershipsSlice,
customers: customersSlice,
products: productsSlice,
product_variants: product_variantsSlice,
tax_rates: tax_ratesSlice,
discounts: discountsSlice,
registers: registersSlice,
shifts: shiftsSlice,
carts: cartsSlice,
cart_items: cart_itemsSlice,
orders: ordersSlice,
order_items: order_itemsSlice,
payment_intents: payment_intentsSlice,
payments: paymentsSlice,
refunds: refundsSlice,
inventory_items: inventory_itemsSlice,
inventory_adjustments: inventory_adjustmentsSlice,
partners: partnersSlice,
tenant_partnerships: tenant_partnershipsSlice,
payouts: payoutsSlice,
helcim_configurations: helcim_configurationsSlice,
reports: reportsSlice,
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
