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 suppliersSlice from "./suppliers/suppliersSlice";
import customersSlice from "./customers/customersSlice";
import uomsSlice from "./uoms/uomsSlice";
import itemsSlice from "./items/itemsSlice";
import item_supplier_linksSlice from "./item_supplier_links/item_supplier_linksSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/locationsSlice";
import inventory_lotsSlice from "./inventory_lots/inventory_lotsSlice";
import inventory_balancesSlice from "./inventory_balances/inventory_balancesSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import bom_headersSlice from "./bom_headers/bom_headersSlice";
import bom_linesSlice from "./bom_lines/bom_linesSlice";
import work_centersSlice from "./work_centers/work_centersSlice";
import machinesSlice from "./machines/machinesSlice";
import routing_headersSlice from "./routing_headers/routing_headersSlice";
import routing_operationsSlice from "./routing_operations/routing_operationsSlice";
import production_ordersSlice from "./production_orders/production_ordersSlice";
import production_operationsSlice from "./production_operations/production_operationsSlice";
import material_issuesSlice from "./material_issues/material_issuesSlice";
import production_receiptsSlice from "./production_receipts/production_receiptsSlice";
import qa_inspection_plansSlice from "./qa_inspection_plans/qa_inspection_plansSlice";
import qa_inspectionsSlice from "./qa_inspections/qa_inspectionsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import capa_actionsSlice from "./capa_actions/capa_actionsSlice";
import maintenance_work_ordersSlice from "./maintenance_work_orders/maintenance_work_ordersSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_linesSlice from "./purchase_order_lines/purchase_order_linesSlice";
import sales_ordersSlice from "./sales_orders/sales_ordersSlice";
import sales_order_linesSlice from "./sales_order_lines/sales_order_linesSlice";
import shipmentsSlice from "./shipments/shipmentsSlice";
import shipment_linesSlice from "./shipment_lines/shipment_linesSlice";
import cost_centersSlice from "./cost_centers/cost_centersSlice";
import cost_elementsSlice from "./cost_elements/cost_elementsSlice";
import standard_costsSlice from "./standard_costs/standard_costsSlice";
import production_costsSlice from "./production_costs/production_costsSlice";
import price_listsSlice from "./price_lists/price_listsSlice";
import price_list_linesSlice from "./price_list_lines/price_list_linesSlice";
import documentsSlice from "./documents/documentsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
suppliers: suppliersSlice,
customers: customersSlice,
uoms: uomsSlice,
items: itemsSlice,
item_supplier_links: item_supplier_linksSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
inventory_lots: inventory_lotsSlice,
inventory_balances: inventory_balancesSlice,
inventory_transactions: inventory_transactionsSlice,
bom_headers: bom_headersSlice,
bom_lines: bom_linesSlice,
work_centers: work_centersSlice,
machines: machinesSlice,
routing_headers: routing_headersSlice,
routing_operations: routing_operationsSlice,
production_orders: production_ordersSlice,
production_operations: production_operationsSlice,
material_issues: material_issuesSlice,
production_receipts: production_receiptsSlice,
qa_inspection_plans: qa_inspection_plansSlice,
qa_inspections: qa_inspectionsSlice,
nonconformances: nonconformancesSlice,
capa_actions: capa_actionsSlice,
maintenance_work_orders: maintenance_work_ordersSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
sales_orders: sales_ordersSlice,
sales_order_lines: sales_order_linesSlice,
shipments: shipmentsSlice,
shipment_lines: shipment_linesSlice,
cost_centers: cost_centersSlice,
cost_elements: cost_elementsSlice,
standard_costs: standard_costsSlice,
production_costs: production_costsSlice,
price_lists: price_listsSlice,
price_list_lines: price_list_linesSlice,
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
