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 item_categoriesSlice from "./item_categories/item_categoriesSlice";
import itemsSlice from "./items/itemsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/locationsSlice";
import lotsSlice from "./lots/lotsSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import bomsSlice from "./boms/bomsSlice";
import bom_linesSlice from "./bom_lines/bom_linesSlice";
import routesSlice from "./routes/routesSlice";
import operationsSlice from "./operations/operationsSlice";
import machinesSlice from "./machines/machinesSlice";
import machine_downtime_eventsSlice from "./machine_downtime_events/machine_downtime_eventsSlice";
import work_centersSlice from "./work_centers/work_centersSlice";
import production_linesSlice from "./production_lines/production_linesSlice";
import work_ordersSlice from "./work_orders/work_ordersSlice";
import work_order_operationsSlice from "./work_order_operations/work_order_operationsSlice";
import material_issuesSlice from "./material_issues/material_issuesSlice";
import material_issue_linesSlice from "./material_issue_lines/material_issue_linesSlice";
import receiptsSlice from "./receipts/receiptsSlice";
import receipt_linesSlice from "./receipt_lines/receipt_linesSlice";
import shipmentsSlice from "./shipments/shipmentsSlice";
import shipment_linesSlice from "./shipment_lines/shipment_linesSlice";
import qa_inspection_plansSlice from "./qa_inspection_plans/qa_inspection_plansSlice";
import qa_characteristicsSlice from "./qa_characteristics/qa_characteristicsSlice";
import qa_inspectionsSlice from "./qa_inspections/qa_inspectionsSlice";
import qa_resultsSlice from "./qa_results/qa_resultsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
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,
suppliers: suppliersSlice,
customers: customersSlice,
uoms: uomsSlice,
item_categories: item_categoriesSlice,
items: itemsSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
lots: lotsSlice,
inventory_transactions: inventory_transactionsSlice,
boms: bomsSlice,
bom_lines: bom_linesSlice,
routes: routesSlice,
operations: operationsSlice,
machines: machinesSlice,
machine_downtime_events: machine_downtime_eventsSlice,
work_centers: work_centersSlice,
production_lines: production_linesSlice,
work_orders: work_ordersSlice,
work_order_operations: work_order_operationsSlice,
material_issues: material_issuesSlice,
material_issue_lines: material_issue_linesSlice,
receipts: receiptsSlice,
receipt_lines: receipt_linesSlice,
shipments: shipmentsSlice,
shipment_lines: shipment_linesSlice,
qa_inspection_plans: qa_inspection_plansSlice,
qa_characteristics: qa_characteristicsSlice,
qa_inspections: qa_inspectionsSlice,
qa_results: qa_resultsSlice,
nonconformances: nonconformancesSlice,
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
