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 plantsSlice from "./plants/plantsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import storage_locationsSlice from "./storage_locations/storage_locationsSlice";
import units_of_measureSlice from "./units_of_measure/units_of_measureSlice";
import materialsSlice from "./materials/materialsSlice";
import material_revisionsSlice from "./material_revisions/material_revisionsSlice";
import bomsSlice from "./boms/bomsSlice";
import bom_linesSlice from "./bom_lines/bom_linesSlice";
import routingsSlice from "./routings/routingsSlice";
import operationsSlice from "./operations/operationsSlice";
import work_centersSlice from "./work_centers/work_centersSlice";
import machinesSlice from "./machines/machinesSlice";
import machine_readingsSlice from "./machine_readings/machine_readingsSlice";
import maintenance_work_ordersSlice from "./maintenance_work_orders/maintenance_work_ordersSlice";
import shiftsSlice from "./shifts/shiftsSlice";
import production_ordersSlice from "./production_orders/production_ordersSlice";
import work_order_operationsSlice from "./work_order_operations/work_order_operationsSlice";
import inventory_lotsSlice from "./inventory_lots/inventory_lotsSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_linesSlice from "./purchase_order_lines/purchase_order_linesSlice";
import quality_standardsSlice from "./quality_standards/quality_standardsSlice";
import inspection_plansSlice from "./inspection_plans/inspection_plansSlice";
import inspectionsSlice from "./inspections/inspectionsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import capasSlice from "./capas/capasSlice";
import alertsSlice from "./alerts/alertsSlice";
import csv_import_jobsSlice from "./csv_import_jobs/csv_import_jobsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
suppliers: suppliersSlice,
customers: customersSlice,
plants: plantsSlice,
warehouses: warehousesSlice,
storage_locations: storage_locationsSlice,
units_of_measure: units_of_measureSlice,
materials: materialsSlice,
material_revisions: material_revisionsSlice,
boms: bomsSlice,
bom_lines: bom_linesSlice,
routings: routingsSlice,
operations: operationsSlice,
work_centers: work_centersSlice,
machines: machinesSlice,
machine_readings: machine_readingsSlice,
maintenance_work_orders: maintenance_work_ordersSlice,
shifts: shiftsSlice,
production_orders: production_ordersSlice,
work_order_operations: work_order_operationsSlice,
inventory_lots: inventory_lotsSlice,
inventory_transactions: inventory_transactionsSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
quality_standards: quality_standardsSlice,
inspection_plans: inspection_plansSlice,
inspections: inspectionsSlice,
nonconformances: nonconformancesSlice,
capas: capasSlice,
alerts: alertsSlice,
csv_import_jobs: csv_import_jobsSlice,
  },
})

// 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
