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 company_locationsSlice from "./company_locations/company_locationsSlice";
import company_contactsSlice from "./company_contacts/company_contactsSlice";
import company_bank_accountsSlice from "./company_bank_accounts/company_bank_accountsSlice";
import company_permitsSlice from "./company_permits/company_permitsSlice";
import company_insurancesSlice from "./company_insurances/company_insurancesSlice";
import company_documentsSlice from "./company_documents/company_documentsSlice";
import company_document_versionsSlice from "./company_document_versions/company_document_versionsSlice";
import employeesSlice from "./employees/employeesSlice";
import employee_assignmentsSlice from "./employee_assignments/employee_assignmentsSlice";
import employee_hr_recordsSlice from "./employee_hr_records/employee_hr_recordsSlice";
import driver_profilesSlice from "./driver_profiles/driver_profilesSlice";
import driver_compliancesSlice from "./driver_compliances/driver_compliancesSlice";
import incidentsSlice from "./incidents/incidentsSlice";
import documentsSlice from "./documents/documentsSlice";
import document_versionsSlice from "./document_versions/document_versionsSlice";
import document_retention_policiesSlice from "./document_retention_policies/document_retention_policiesSlice";
import customersSlice from "./customers/customersSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import vehiclesSlice from "./vehicles/vehiclesSlice";
import trailersSlice from "./trailers/trailersSlice";
import vehicle_trailer_linksSlice from "./vehicle_trailer_links/vehicle_trailer_linksSlice";
import vehicle_inspectionsSlice from "./vehicle_inspections/vehicle_inspectionsSlice";
import vehicle_maintenancesSlice from "./vehicle_maintenances/vehicle_maintenancesSlice";
import vehicle_insurancesSlice from "./vehicle_insurances/vehicle_insurancesSlice";
import vehicle_documentsSlice from "./vehicle_documents/vehicle_documentsSlice";
import vehicle_document_versionsSlice from "./vehicle_document_versions/vehicle_document_versionsSlice";
import driver_vehicle_assignmentsSlice from "./driver_vehicle_assignments/driver_vehicle_assignmentsSlice";
import ordersSlice from "./orders/ordersSlice";
import loadsSlice from "./loads/loadsSlice";
import load_stopsSlice from "./load_stops/load_stopsSlice";
import tripsSlice from "./trips/tripsSlice";
import trip_loadsSlice from "./trip_loads/trip_loadsSlice";
import pod_filesSlice from "./pod_files/pod_filesSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_linesSlice from "./invoice_lines/invoice_linesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import cost_itemsSlice from "./cost_items/cost_itemsSlice";
import cost_filesSlice from "./cost_files/cost_filesSlice";
import fuel_entriesSlice from "./fuel_entries/fuel_entriesSlice";
import toll_entriesSlice from "./toll_entries/toll_entriesSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
companies: companiesSlice,
company_locations: company_locationsSlice,
company_contacts: company_contactsSlice,
company_bank_accounts: company_bank_accountsSlice,
company_permits: company_permitsSlice,
company_insurances: company_insurancesSlice,
company_documents: company_documentsSlice,
company_document_versions: company_document_versionsSlice,
employees: employeesSlice,
employee_assignments: employee_assignmentsSlice,
employee_hr_records: employee_hr_recordsSlice,
driver_profiles: driver_profilesSlice,
driver_compliances: driver_compliancesSlice,
incidents: incidentsSlice,
documents: documentsSlice,
document_versions: document_versionsSlice,
document_retention_policies: document_retention_policiesSlice,
customers: customersSlice,
vendors: vendorsSlice,
vehicles: vehiclesSlice,
trailers: trailersSlice,
vehicle_trailer_links: vehicle_trailer_linksSlice,
vehicle_inspections: vehicle_inspectionsSlice,
vehicle_maintenances: vehicle_maintenancesSlice,
vehicle_insurances: vehicle_insurancesSlice,
vehicle_documents: vehicle_documentsSlice,
vehicle_document_versions: vehicle_document_versionsSlice,
driver_vehicle_assignments: driver_vehicle_assignmentsSlice,
orders: ordersSlice,
loads: loadsSlice,
load_stops: load_stopsSlice,
trips: tripsSlice,
trip_loads: trip_loadsSlice,
pod_files: pod_filesSlice,
invoices: invoicesSlice,
invoice_lines: invoice_linesSlice,
payments: paymentsSlice,
cost_items: cost_itemsSlice,
cost_files: cost_filesSlice,
fuel_entries: fuel_entriesSlice,
toll_entries: toll_entriesSlice,
  },
})

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