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 organization_membershipsSlice from "./organization_memberships/organization_membershipsSlice";
import tax_ratesSlice from "./tax_rates/tax_ratesSlice";
import payment_termsSlice from "./payment_terms/payment_termsSlice";
import numbering_sequencesSlice from "./numbering_sequences/numbering_sequencesSlice";
import clientsSlice from "./clients/clientsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import product_categoriesSlice from "./product_categories/product_categoriesSlice";
import unitsSlice from "./units/unitsSlice";
import productsSlice from "./products/productsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import quotesSlice from "./quotes/quotesSlice";
import quote_itemsSlice from "./quote_items/quote_itemsSlice";
import sales_ordersSlice from "./sales_orders/sales_ordersSlice";
import sales_order_itemsSlice from "./sales_order_items/sales_order_itemsSlice";
import delivery_notesSlice from "./delivery_notes/delivery_notesSlice";
import delivery_note_itemsSlice from "./delivery_note_items/delivery_note_itemsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_itemsSlice from "./invoice_items/invoice_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import credit_notesSlice from "./credit_notes/credit_notesSlice";
import credit_note_itemsSlice from "./credit_note_items/credit_note_itemsSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_itemsSlice from "./purchase_order_items/purchase_order_itemsSlice";
import stock_receptionsSlice from "./stock_receptions/stock_receptionsSlice";
import stock_reception_itemsSlice from "./stock_reception_items/stock_reception_itemsSlice";
import stock_reservationsSlice from "./stock_reservations/stock_reservationsSlice";
import stock_movementsSlice from "./stock_movements/stock_movementsSlice";
import inventory_countsSlice from "./inventory_counts/inventory_countsSlice";
import inventory_count_itemsSlice from "./inventory_count_items/inventory_count_itemsSlice";
import import_jobsSlice from "./import_jobs/import_jobsSlice";
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,
organizations: organizationsSlice,
organization_memberships: organization_membershipsSlice,
tax_rates: tax_ratesSlice,
payment_terms: payment_termsSlice,
numbering_sequences: numbering_sequencesSlice,
clients: clientsSlice,
suppliers: suppliersSlice,
product_categories: product_categoriesSlice,
units: unitsSlice,
products: productsSlice,
warehouses: warehousesSlice,
quotes: quotesSlice,
quote_items: quote_itemsSlice,
sales_orders: sales_ordersSlice,
sales_order_items: sales_order_itemsSlice,
delivery_notes: delivery_notesSlice,
delivery_note_items: delivery_note_itemsSlice,
invoices: invoicesSlice,
invoice_items: invoice_itemsSlice,
payments: paymentsSlice,
credit_notes: credit_notesSlice,
credit_note_items: credit_note_itemsSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_items: purchase_order_itemsSlice,
stock_receptions: stock_receptionsSlice,
stock_reception_items: stock_reception_itemsSlice,
stock_reservations: stock_reservationsSlice,
stock_movements: stock_movementsSlice,
inventory_counts: inventory_countsSlice,
inventory_count_items: inventory_count_itemsSlice,
import_jobs: import_jobsSlice,
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
