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 work_centersSlice from "./work_centers/work_centersSlice";
import machinesSlice from "./machines/machinesSlice";
import maintenance_work_ordersSlice from "./maintenance_work_orders/maintenance_work_ordersSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import units_of_measureSlice from "./units_of_measure/units_of_measureSlice";
import materialsSlice from "./materials/materialsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import storage_locationsSlice from "./storage_locations/storage_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 bomsSlice from "./boms/bomsSlice";
import bom_itemsSlice from "./bom_items/bom_itemsSlice";
import routingsSlice from "./routings/routingsSlice";
import routing_stepsSlice from "./routing_steps/routing_stepsSlice";
import production_ordersSlice from "./production_orders/production_ordersSlice";
import production_operationsSlice from "./production_operations/production_operationsSlice";
import production_material_issuesSlice from "./production_material_issues/production_material_issuesSlice";
import production_lotsSlice from "./production_lots/production_lotsSlice";
import qa_inspectionsSlice from "./qa_inspections/qa_inspectionsSlice";
import qa_checklistsSlice from "./qa_checklists/qa_checklistsSlice";
import qa_checklist_itemsSlice from "./qa_checklist_items/qa_checklist_itemsSlice";
import qa_measurementsSlice from "./qa_measurements/qa_measurementsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import documentsSlice from "./documents/documentsSlice";
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,
work_centers: work_centersSlice,
machines: machinesSlice,
maintenance_work_orders: maintenance_work_ordersSlice,
suppliers: suppliersSlice,
units_of_measure: units_of_measureSlice,
materials: materialsSlice,
warehouses: warehousesSlice,
storage_locations: storage_locationsSlice,
inventory_lots: inventory_lotsSlice,
inventory_balances: inventory_balancesSlice,
inventory_transactions: inventory_transactionsSlice,
boms: bomsSlice,
bom_items: bom_itemsSlice,
routings: routingsSlice,
routing_steps: routing_stepsSlice,
production_orders: production_ordersSlice,
production_operations: production_operationsSlice,
production_material_issues: production_material_issuesSlice,
production_lots: production_lotsSlice,
qa_inspections: qa_inspectionsSlice,
qa_checklists: qa_checklistsSlice,
qa_checklist_items: qa_checklist_itemsSlice,
qa_measurements: qa_measurementsSlice,
nonconformances: nonconformancesSlice,
documents: documentsSlice,
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
