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 claimsSlice from './claims/claimsSlice';
import clientsSlice from './clients/clientsSlice';
import company_profilesSlice from './company_profiles/company_profilesSlice';
import driversSlice from './drivers/driversSlice';
import expensesSlice from './expenses/expensesSlice';
import guaranteesSlice from './guarantees/guaranteesSlice';
import infractionsSlice from './infractions/infractionsSlice';
import invoices_saasSlice from './invoices_saas/invoices_saasSlice';
import maintenanceSlice from './maintenance/maintenanceSlice';
import paymentsSlice from './payments/paymentsSlice';
import plansSlice from './plans/plansSlice';
import reservationsSlice from './reservations/reservationsSlice';
import subscriptionsSlice from './subscriptions/subscriptionsSlice';
import tenantsSlice from './tenants/tenantsSlice';
import vehicle_conditionsSlice from './vehicle_conditions/vehicle_conditionsSlice';
import vehiclesSlice from './vehicles/vehiclesSlice';
import rolesSlice from './roles/rolesSlice';
import permissionsSlice from './permissions/permissionsSlice';
import agencesSlice from './agences/agencesSlice';

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

    users: usersSlice,
    claims: claimsSlice,
    clients: clientsSlice,
    company_profiles: company_profilesSlice,
    drivers: driversSlice,
    expenses: expensesSlice,
    guarantees: guaranteesSlice,
    infractions: infractionsSlice,
    invoices_saas: invoices_saasSlice,
    maintenance: maintenanceSlice,
    payments: paymentsSlice,
    plans: plansSlice,
    reservations: reservationsSlice,
    subscriptions: subscriptionsSlice,
    tenants: tenantsSlice,
    vehicle_conditions: vehicle_conditionsSlice,
    vehicles: vehiclesSlice,
    roles: rolesSlice,
    permissions: permissionsSlice,
    agences: agencesSlice,
  },
});

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