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 role_permissionsSlice from "./role_permissions/role_permissionsSlice";
import clientsSlice from "./clients/clientsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import categoriesSlice from "./categories/categoriesSlice";
import productsSlice from "./products/productsSlice";
import stock_movementsSlice from "./stock_movements/stock_movementsSlice";
import quotesSlice from "./quotes/quotesSlice";
import quote_itemsSlice from "./quote_items/quote_itemsSlice";
import salesSlice from "./sales/salesSlice";
import sale_itemsSlice from "./sale_items/sale_itemsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_itemsSlice from "./invoice_items/invoice_itemsSlice";
import paymentsSlice from "./payments/paymentsSlice";
import expensesSlice from "./expenses/expensesSlice";
import cash_movementsSlice from "./cash_movements/cash_movementsSlice";
import poultry_lotsSlice from "./poultry_lots/poultry_lotsSlice";
import egg_collectionsSlice from "./egg_collections/egg_collectionsSlice";
import treatmentsSlice from "./treatments/treatmentsSlice";
import alertsSlice from "./alerts/alertsSlice";
import settingsSlice from "./settings/settingsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
role_permissions: role_permissionsSlice,
clients: clientsSlice,
suppliers: suppliersSlice,
categories: categoriesSlice,
products: productsSlice,
stock_movements: stock_movementsSlice,
quotes: quotesSlice,
quote_items: quote_itemsSlice,
sales: salesSlice,
sale_items: sale_itemsSlice,
invoices: invoicesSlice,
invoice_items: invoice_itemsSlice,
payments: paymentsSlice,
expenses: expensesSlice,
cash_movements: cash_movementsSlice,
poultry_lots: poultry_lotsSlice,
egg_collections: egg_collectionsSlice,
treatments: treatmentsSlice,
alerts: alertsSlice,
settings: settingsSlice,
audit_logs: audit_logsSlice,
  },
})

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