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 assetsSlice from './assets/assetsSlice';
import employeesSlice from './employees/employeesSlice';
import financial_recordsSlice from './financial_records/financial_recordsSlice';
import inventoriesSlice from './inventories/inventoriesSlice';
import manufacturing_ordersSlice from './manufacturing_orders/manufacturing_ordersSlice';
import procurementsSlice from './procurements/procurementsSlice';
import projectsSlice from './projects/projectsSlice';
import salesSlice from './sales/salesSlice';
import subscriptionsSlice from './subscriptions/subscriptionsSlice';
import invoicesSlice from './invoices/invoicesSlice';
import paymentsSlice from './payments/paymentsSlice';
import contractsSlice from './contracts/contractsSlice';
import shipmentsSlice from './shipments/shipmentsSlice';
import warehousesSlice from './warehouses/warehousesSlice';
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 leadsSlice from './leads/leadsSlice';
import ticketsSlice from './tickets/ticketsSlice';
import marketing_campaignsSlice from './marketing_campaigns/marketing_campaignsSlice';
import audit_logsSlice from './audit_logs/audit_logsSlice';
import notificationsSlice from './notifications/notificationsSlice';
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,
    assets: assetsSlice,
    employees: employeesSlice,
    financial_records: financial_recordsSlice,
    inventories: inventoriesSlice,
    manufacturing_orders: manufacturing_ordersSlice,
    procurements: procurementsSlice,
    projects: projectsSlice,
    sales: salesSlice,
    subscriptions: subscriptionsSlice,
    invoices: invoicesSlice,
    payments: paymentsSlice,
    contracts: contractsSlice,
    shipments: shipmentsSlice,
    warehouses: warehousesSlice,
    payrolls: payrollsSlice,
    attendance: attendanceSlice,
    leave_requests: leave_requestsSlice,
    recruitment: recruitmentSlice,
    budgets: budgetsSlice,
    taxes: taxesSlice,
    expenses: expensesSlice,
    revenues: revenuesSlice,
    leads: leadsSlice,
    tickets: ticketsSlice,
    marketing_campaigns: marketing_campaignsSlice,
    audit_logs: audit_logsSlice,
    notifications: notificationsSlice,
    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;
