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 plantsSlice from "./plants/plantsSlice";
import work_centersSlice from "./work_centers/work_centersSlice";
import machinesSlice from "./machines/machinesSlice";
import machine_eventsSlice from "./machine_events/machine_eventsSlice";
import uomsSlice from "./uoms/uomsSlice";
import itemsSlice from "./items/itemsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/locationsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import customersSlice from "./customers/customersSlice";
import bomsSlice from "./boms/bomsSlice";
import bom_linesSlice from "./bom_lines/bom_linesSlice";
import routingsSlice from "./routings/routingsSlice";
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_requirementsSlice from "./material_requirements/material_requirementsSlice";
import lotsSlice from "./lots/lotsSlice";
import serial_numbersSlice from "./serial_numbers/serial_numbersSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import inspectionsSlice from "./inspections/inspectionsSlice";
import inspection_resultsSlice from "./inspection_results/inspection_resultsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import quality_holdsSlice from "./quality_holds/quality_holdsSlice";
import maintenance_work_ordersSlice from "./maintenance_work_orders/maintenance_work_ordersSlice";
import documentsSlice from "./documents/documentsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
plants: plantsSlice,
work_centers: work_centersSlice,
machines: machinesSlice,
machine_events: machine_eventsSlice,
uoms: uomsSlice,
items: itemsSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
suppliers: suppliersSlice,
customers: customersSlice,
boms: bomsSlice,
bom_lines: bom_linesSlice,
routings: routingsSlice,
routing_operations: routing_operationsSlice,
production_orders: production_ordersSlice,
production_operations: production_operationsSlice,
material_requirements: material_requirementsSlice,
lots: lotsSlice,
serial_numbers: serial_numbersSlice,
inventory_transactions: inventory_transactionsSlice,
inspections: inspectionsSlice,
inspection_results: inspection_resultsSlice,
nonconformances: nonconformancesSlice,
quality_holds: quality_holdsSlice,
maintenance_work_orders: maintenance_work_ordersSlice,
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
