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 maintenance_work_ordersSlice from "./maintenance_work_orders/maintenance_work_ordersSlice";
import downtime_eventsSlice from "./downtime_events/downtime_eventsSlice";
import uomsSlice from "./uoms/uomsSlice";
import item_categoriesSlice from "./item_categories/item_categoriesSlice";
import itemsSlice from "./items/itemsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/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 suppliersSlice from "./suppliers/suppliersSlice";
import customersSlice from "./customers/customersSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_linesSlice from "./purchase_order_lines/purchase_order_linesSlice";
import receiptsSlice from "./receipts/receiptsSlice";
import receipt_linesSlice from "./receipt_lines/receipt_linesSlice";
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 production_materialsSlice from "./production_materials/production_materialsSlice";
import production_outputsSlice from "./production_outputs/production_outputsSlice";
import qa_plansSlice from "./qa_plans/qa_plansSlice";
import qa_characteristicsSlice from "./qa_characteristics/qa_characteristicsSlice";
import qa_inspectionsSlice from "./qa_inspections/qa_inspectionsSlice";
import qa_resultsSlice from "./qa_results/qa_resultsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import documentsSlice from "./documents/documentsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import gl_accountsSlice from "./gl_accounts/gl_accountsSlice";
import journal_entriesSlice from "./journal_entries/journal_entriesSlice";
import journal_linesSlice from "./journal_lines/journal_linesSlice";
import cost_centersSlice from "./cost_centers/cost_centersSlice";
import item_costsSlice from "./item_costs/item_costsSlice";

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,
maintenance_work_orders: maintenance_work_ordersSlice,
downtime_events: downtime_eventsSlice,
uoms: uomsSlice,
item_categories: item_categoriesSlice,
items: itemsSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
inventory_lots: inventory_lotsSlice,
inventory_balances: inventory_balancesSlice,
inventory_transactions: inventory_transactionsSlice,
suppliers: suppliersSlice,
customers: customersSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
receipts: receiptsSlice,
receipt_lines: receipt_linesSlice,
boms: bomsSlice,
bom_lines: bom_linesSlice,
routings: routingsSlice,
routing_operations: routing_operationsSlice,
production_orders: production_ordersSlice,
production_operations: production_operationsSlice,
production_materials: production_materialsSlice,
production_outputs: production_outputsSlice,
qa_plans: qa_plansSlice,
qa_characteristics: qa_characteristicsSlice,
qa_inspections: qa_inspectionsSlice,
qa_results: qa_resultsSlice,
nonconformances: nonconformancesSlice,
documents: documentsSlice,
audit_logs: audit_logsSlice,
gl_accounts: gl_accountsSlice,
journal_entries: journal_entriesSlice,
journal_lines: journal_linesSlice,
cost_centers: cost_centersSlice,
item_costs: item_costsSlice,
  },
})

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