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 companiesSlice from "./companies/companiesSlice";
import driversSlice from "./drivers/driversSlice";
import vehiclesSlice from "./vehicles/vehiclesSlice";
import agreementsSlice from "./agreements/agreementsSlice";
import recurring_invoice_templatesSlice from "./recurring_invoice_templates/recurring_invoice_templatesSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import chart_of_accountsSlice from "./chart_of_accounts/chart_of_accountsSlice";
import invoice_linesSlice from "./invoice_lines/invoice_linesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import payment_allocationsSlice from "./payment_allocations/payment_allocationsSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import vehicle_expensesSlice from "./vehicle_expenses/vehicle_expensesSlice";
import driver_expensesSlice from "./driver_expenses/driver_expensesSlice";
import billsSlice from "./bills/billsSlice";
import bill_linesSlice from "./bill_lines/bill_linesSlice";
import bill_paymentsSlice from "./bill_payments/bill_paymentsSlice";
import ledger_entriesSlice from "./ledger_entries/ledger_entriesSlice";
import loan_schedulesSlice from "./loan_schedules/loan_schedulesSlice";
import vehicle_complianceSlice from "./vehicle_compliance/vehicle_complianceSlice";
import documentsSlice from "./documents/documentsSlice";
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,
companies: companiesSlice,
drivers: driversSlice,
vehicles: vehiclesSlice,
agreements: agreementsSlice,
recurring_invoice_templates: recurring_invoice_templatesSlice,
invoices: invoicesSlice,
chart_of_accounts: chart_of_accountsSlice,
invoice_lines: invoice_linesSlice,
payments: paymentsSlice,
payment_allocations: payment_allocationsSlice,
vendors: vendorsSlice,
vehicle_expenses: vehicle_expensesSlice,
driver_expenses: driver_expensesSlice,
bills: billsSlice,
bill_lines: bill_linesSlice,
bill_payments: bill_paymentsSlice,
ledger_entries: ledger_entriesSlice,
loan_schedules: loan_schedulesSlice,
vehicle_compliance: vehicle_complianceSlice,
documents: documentsSlice,
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
