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 organizationsSlice from "./organizations/organizationsSlice";
import plantsSlice from "./plants/plantsSlice";
import work_centersSlice from "./work_centers/work_centersSlice";
import machinesSlice from "./machines/machinesSlice";
import materialsSlice from "./materials/materialsSlice";
import bom_headersSlice from "./bom_headers/bom_headersSlice";
import bom_linesSlice from "./bom_lines/bom_linesSlice";
import routingsSlice from "./routings/routingsSlice";
import routing_stepsSlice from "./routing_steps/routing_stepsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import customersSlice from "./customers/customersSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/locationsSlice";
import lotsSlice from "./lots/lotsSlice";
import serialsSlice from "./serials/serialsSlice";
import inventory_balancesSlice from "./inventory_balances/inventory_balancesSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import cycle_countsSlice from "./cycle_counts/cycle_countsSlice";
import cycle_count_linesSlice from "./cycle_count_lines/cycle_count_linesSlice";
import production_ordersSlice from "./production_orders/production_ordersSlice";
import production_operationsSlice from "./production_operations/production_operationsSlice";
import material_allocationsSlice from "./material_allocations/material_allocationsSlice";
import production_lotsSlice from "./production_lots/production_lotsSlice";
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 dispositionsSlice from "./dispositions/dispositionsSlice";
import corrective_actionsSlice from "./corrective_actions/corrective_actionsSlice";
import downtime_eventsSlice from "./downtime_events/downtime_eventsSlice";
import machine_readingsSlice from "./machine_readings/machine_readingsSlice";
import maintenance_work_ordersSlice from "./maintenance_work_orders/maintenance_work_ordersSlice";
import documentsSlice from "./documents/documentsSlice";
import shipmentsSlice from "./shipments/shipmentsSlice";
import shipment_linesSlice from "./shipment_lines/shipment_linesSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
plants: plantsSlice,
work_centers: work_centersSlice,
machines: machinesSlice,
materials: materialsSlice,
bom_headers: bom_headersSlice,
bom_lines: bom_linesSlice,
routings: routingsSlice,
routing_steps: routing_stepsSlice,
suppliers: suppliersSlice,
customers: customersSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
lots: lotsSlice,
serials: serialsSlice,
inventory_balances: inventory_balancesSlice,
inventory_transactions: inventory_transactionsSlice,
cycle_counts: cycle_countsSlice,
cycle_count_lines: cycle_count_linesSlice,
production_orders: production_ordersSlice,
production_operations: production_operationsSlice,
material_allocations: material_allocationsSlice,
production_lots: production_lotsSlice,
inspection_plans: inspection_plansSlice,
inspection_characteristics: inspection_characteristicsSlice,
inspections: inspectionsSlice,
inspection_results: inspection_resultsSlice,
nonconformances: nonconformancesSlice,
dispositions: dispositionsSlice,
corrective_actions: corrective_actionsSlice,
downtime_events: downtime_eventsSlice,
machine_readings: machine_readingsSlice,
maintenance_work_orders: maintenance_work_ordersSlice,
documents: documentsSlice,
shipments: shipmentsSlice,
shipment_lines: shipment_linesSlice,
  },
})

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