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 customersSlice from "./customers/customersSlice";
import contactsSlice from "./contacts/contactsSlice";
import leadsSlice from "./leads/leadsSlice";
import quotesSlice from "./quotes/quotesSlice";
import quote_line_itemsSlice from "./quote_line_items/quote_line_itemsSlice";
import projectsSlice from "./projects/projectsSlice";
import project_milestonesSlice from "./project_milestones/project_milestonesSlice";
import productsSlice from "./products/productsSlice";
import materialsSlice from "./materials/materialsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import inventory_locationsSlice from "./inventory_locations/inventory_locationsSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import bomsSlice from "./boms/bomsSlice";
import bom_itemsSlice from "./bom_items/bom_itemsSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_line_itemsSlice from "./purchase_order_line_items/purchase_order_line_itemsSlice";
import goods_receiptsSlice from "./goods_receipts/goods_receiptsSlice";
import work_ordersSlice from "./work_orders/work_ordersSlice";
import work_order_materialsSlice from "./work_order_materials/work_order_materialsSlice";
import deliveriesSlice from "./deliveries/deliveriesSlice";
import delivery_itemsSlice from "./delivery_items/delivery_itemsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_line_itemsSlice from "./invoice_line_items/invoice_line_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import documentsSlice from "./documents/documentsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
customers: customersSlice,
contacts: contactsSlice,
leads: leadsSlice,
quotes: quotesSlice,
quote_line_items: quote_line_itemsSlice,
projects: projectsSlice,
project_milestones: project_milestonesSlice,
products: productsSlice,
materials: materialsSlice,
suppliers: suppliersSlice,
inventory_locations: inventory_locationsSlice,
inventory_items: inventory_itemsSlice,
inventory_transactions: inventory_transactionsSlice,
boms: bomsSlice,
bom_items: bom_itemsSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_line_items: purchase_order_line_itemsSlice,
goods_receipts: goods_receiptsSlice,
work_orders: work_ordersSlice,
work_order_materials: work_order_materialsSlice,
deliveries: deliveriesSlice,
delivery_items: delivery_itemsSlice,
invoices: invoicesSlice,
invoice_line_items: invoice_line_itemsSlice,
payments: paymentsSlice,
documents: documentsSlice,
  },
})

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