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 organization_membershipsSlice from "./organization_memberships/organization_membershipsSlice";
import currenciesSlice from "./currencies/currenciesSlice";
import tax_ratesSlice from "./tax_rates/tax_ratesSlice";
import accountsSlice from "./accounts/accountsSlice";
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 billsSlice from "./bills/billsSlice";
import bill_linesSlice from "./bill_lines/bill_linesSlice";
import expensesSlice from "./expenses/expensesSlice";
import bank_accountsSlice from "./bank_accounts/bank_accountsSlice";
import bank_transactionsSlice from "./bank_transactions/bank_transactionsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import journal_entriesSlice from "./journal_entries/journal_entriesSlice";
import journal_linesSlice from "./journal_lines/journal_linesSlice";
import documentsSlice from "./documents/documentsSlice";
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,
organization_memberships: organization_membershipsSlice,
currencies: currenciesSlice,
tax_rates: tax_ratesSlice,
accounts: accountsSlice,
contacts: contactsSlice,
products: productsSlice,
warehouses: warehousesSlice,
inventory_items: inventory_itemsSlice,
quotes: quotesSlice,
quote_lines: quote_linesSlice,
invoices: invoicesSlice,
invoice_lines: invoice_linesSlice,
bills: billsSlice,
bill_lines: bill_linesSlice,
expenses: expensesSlice,
bank_accounts: bank_accountsSlice,
bank_transactions: bank_transactionsSlice,
payments: paymentsSlice,
journal_entries: journal_entriesSlice,
journal_lines: journal_linesSlice,
documents: documentsSlice,
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
