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 customersSlice from './customers/customersSlice';
import employeesSlice from './employees/employeesSlice';
import financial_accountsSlice from './financial_accounts/financial_accountsSlice';
import ordersSlice from './orders/ordersSlice';
import productsSlice from './products/productsSlice';
import projectsSlice from './projects/projectsSlice';
import purchase_ordersSlice from './purchase_orders/purchase_ordersSlice';
import tasksSlice from './tasks/tasksSlice';
import transactionsSlice from './transactions/transactionsSlice';
import vendorsSlice from './vendors/vendorsSlice';
import invoicesSlice from './invoices/invoicesSlice';
import paymentsSlice from './payments/paymentsSlice';
import subscriptionsSlice from './subscriptions/subscriptionsSlice';
import contractsSlice from './contracts/contractsSlice';
import shipmentsSlice from './shipments/shipmentsSlice';
import warehousesSlice from './warehouses/warehousesSlice';
import assetsSlice from './assets/assetsSlice';
import payrollsSlice from './payrolls/payrollsSlice';
import attendanceSlice from './attendance/attendanceSlice';
import leave_requestsSlice from './leave_requests/leave_requestsSlice';
import recruitmentSlice from './recruitment/recruitmentSlice';
import budgetsSlice from './budgets/budgetsSlice';
import taxesSlice from './taxes/taxesSlice';
import expensesSlice from './expenses/expensesSlice';
import revenuesSlice from './revenues/revenuesSlice';
import rolesSlice from './roles/rolesSlice';
import permissionsSlice from './permissions/permissionsSlice';
import companiesSlice from './companies/companiesSlice';

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

    users: usersSlice,
    customers: customersSlice,
    employees: employeesSlice,
    financial_accounts: financial_accountsSlice,
    orders: ordersSlice,
    products: productsSlice,
    projects: projectsSlice,
    purchase_orders: purchase_ordersSlice,
    tasks: tasksSlice,
    transactions: transactionsSlice,
    vendors: vendorsSlice,
    invoices: invoicesSlice,
    payments: paymentsSlice,
    subscriptions: subscriptionsSlice,
    contracts: contractsSlice,
    shipments: shipmentsSlice,
    warehouses: warehousesSlice,
    assets: assetsSlice,
    payrolls: payrollsSlice,
    attendance: attendanceSlice,
    leave_requests: leave_requestsSlice,
    recruitment: recruitmentSlice,
    budgets: budgetsSlice,
    taxes: taxesSlice,
    expenses: expensesSlice,
    revenues: revenuesSlice,
    roles: rolesSlice,
    permissions: permissionsSlice,
    companies: companiesSlice,
  },
});

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