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 warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/locationsSlice";
import itemsSlice from "./items/itemsSlice";
import approved_vendorsSlice from "./approved_vendors/approved_vendorsSlice";
import bomsSlice from "./boms/bomsSlice";
import bom_linesSlice from "./bom_lines/bom_linesSlice";
import routingsSlice from "./routings/routingsSlice";
import work_centersSlice from "./work_centers/work_centersSlice";
import routing_operationsSlice from "./routing_operations/routing_operationsSlice";
import machinesSlice from "./machines/machinesSlice";
import machine_eventsSlice from "./machine_events/machine_eventsSlice";
import reason_codesSlice from "./reason_codes/reason_codesSlice";
import work_ordersSlice from "./work_orders/work_ordersSlice";
import work_order_operationsSlice from "./work_order_operations/work_order_operationsSlice";
import lotsSlice from "./lots/lotsSlice";
import serialsSlice from "./serials/serialsSlice";
import inventory_balancesSlice from "./inventory_balances/inventory_balancesSlice";
import inventory_movementsSlice from "./inventory_movements/inventory_movementsSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_linesSlice from "./purchase_order_lines/purchase_order_linesSlice";
import inspection_plansSlice from "./inspection_plans/inspection_plansSlice";
import inspection_characteristicsSlice from "./inspection_characteristics/inspection_characteristicsSlice";
import inspectionsSlice from "./inspections/inspectionsSlice";
import inspection_resultsSlice from "./inspection_results/inspection_resultsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import disposition_codesSlice from "./disposition_codes/disposition_codesSlice";
import capa_actionsSlice from "./capa_actions/capa_actionsSlice";
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,
suppliers: suppliersSlice,
customers: customersSlice,
uoms: uomsSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
items: itemsSlice,
approved_vendors: approved_vendorsSlice,
boms: bomsSlice,
bom_lines: bom_linesSlice,
routings: routingsSlice,
work_centers: work_centersSlice,
routing_operations: routing_operationsSlice,
machines: machinesSlice,
machine_events: machine_eventsSlice,
reason_codes: reason_codesSlice,
work_orders: work_ordersSlice,
work_order_operations: work_order_operationsSlice,
lots: lotsSlice,
serials: serialsSlice,
inventory_balances: inventory_balancesSlice,
inventory_movements: inventory_movementsSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
inspection_plans: inspection_plansSlice,
inspection_characteristics: inspection_characteristicsSlice,
inspections: inspectionsSlice,
inspection_results: inspection_resultsSlice,
nonconformances: nonconformancesSlice,
disposition_codes: disposition_codesSlice,
capa_actions: capa_actionsSlice,
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
