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 companiesSlice from "./companies/companiesSlice";
import contactsSlice from "./contacts/contactsSlice";
import pipelinesSlice from "./pipelines/pipelinesSlice";
import pipeline_stagesSlice from "./pipeline_stages/pipeline_stagesSlice";
import leadsSlice from "./leads/leadsSlice";
import dealsSlice from "./deals/dealsSlice";
import activitiesSlice from "./activities/activitiesSlice";
import materialsSlice from "./materials/materialsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import machinesSlice from "./machines/machinesSlice";
import production_ordersSlice from "./production_orders/production_ordersSlice";
import production_operationsSlice from "./production_operations/production_operationsSlice";
import quality_inspectionsSlice from "./quality_inspections/quality_inspectionsSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import venuesSlice from "./venues/venuesSlice";
import eventsSlice from "./events/eventsSlice";
import event_tasksSlice from "./event_tasks/event_tasksSlice";
import event_guestsSlice from "./event_guests/event_guestsSlice";
import event_schedule_itemsSlice from "./event_schedule_items/event_schedule_itemsSlice";
import budget_itemsSlice from "./budget_items/budget_itemsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
companies: companiesSlice,
contacts: contactsSlice,
pipelines: pipelinesSlice,
pipeline_stages: pipeline_stagesSlice,
leads: leadsSlice,
deals: dealsSlice,
activities: activitiesSlice,
materials: materialsSlice,
warehouses: warehousesSlice,
inventory_items: inventory_itemsSlice,
machines: machinesSlice,
production_orders: production_ordersSlice,
production_operations: production_operationsSlice,
quality_inspections: quality_inspectionsSlice,
nonconformances: nonconformancesSlice,
vendors: vendorsSlice,
venues: venuesSlice,
events: eventsSlice,
event_tasks: event_tasksSlice,
event_guests: event_guestsSlice,
event_schedule_items: event_schedule_itemsSlice,
budget_items: budget_itemsSlice,
  },
})

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