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 membershipsSlice from "./memberships/membershipsSlice";
import organization_settingsSlice from "./organization_settings/organization_settingsSlice";
import tax_codesSlice from "./tax_codes/tax_codesSlice";
import contactsSlice from "./contacts/contactsSlice";
import productsSlice from "./products/productsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import inventory_itemsSlice from "./inventory_items/inventory_itemsSlice";
import quotesSlice from "./quotes/quotesSlice";
import quote_linesSlice from "./quote_lines/quote_linesSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_linesSlice from "./invoice_lines/invoice_linesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import receiptsSlice from "./receipts/receiptsSlice";
import expensesSlice from "./expenses/expensesSlice";
import approval_requestsSlice from "./approval_requests/approval_requestsSlice";
import projectsSlice from "./projects/projectsSlice";
import tasksSlice from "./tasks/tasksSlice";
import time_entriesSlice from "./time_entries/time_entriesSlice";
import efris_connectionsSlice from "./efris_connections/efris_connectionsSlice";
import efris_submissionsSlice from "./efris_submissions/efris_submissionsSlice";
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,
organizations: organizationsSlice,
memberships: membershipsSlice,
organization_settings: organization_settingsSlice,
tax_codes: tax_codesSlice,
contacts: contactsSlice,
products: productsSlice,
warehouses: warehousesSlice,
inventory_items: inventory_itemsSlice,
quotes: quotesSlice,
quote_lines: quote_linesSlice,
invoices: invoicesSlice,
invoice_lines: invoice_linesSlice,
payments: paymentsSlice,
receipts: receiptsSlice,
expenses: expensesSlice,
approval_requests: approval_requestsSlice,
projects: projectsSlice,
tasks: tasksSlice,
time_entries: time_entriesSlice,
efris_connections: efris_connectionsSlice,
efris_submissions: efris_submissionsSlice,
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
