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 organizationsSlice from "./organizations/organizationsSlice";
import tenantsSlice from "./tenants/tenantsSlice";
import data_entitiesSlice from "./data_entities/data_entitiesSlice";
import import_sourcesSlice from "./import_sources/import_sourcesSlice";
import file_uploadsSlice from "./file_uploads/file_uploadsSlice";
import import_jobsSlice from "./import_jobs/import_jobsSlice";
import import_mappingsSlice from "./import_mappings/import_mappingsSlice";
import mapping_rulesSlice from "./mapping_rules/mapping_rulesSlice";
import validation_rule_setsSlice from "./validation_rule_sets/validation_rule_setsSlice";
import validation_rulesSlice from "./validation_rules/validation_rulesSlice";
import import_row_resultsSlice from "./import_row_results/import_row_resultsSlice";
import import_issuesSlice from "./import_issues/import_issuesSlice";
import import_templatesSlice from "./import_templates/import_templatesSlice";
import productsSlice from "./products/productsSlice";
import customersSlice from "./customers/customersSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import availability_recordsSlice from "./availability_records/availability_recordsSlice";
import audit_eventsSlice from "./audit_events/audit_eventsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
data_entities: data_entitiesSlice,
import_sources: import_sourcesSlice,
file_uploads: file_uploadsSlice,
import_jobs: import_jobsSlice,
import_mappings: import_mappingsSlice,
mapping_rules: mapping_rulesSlice,
validation_rule_sets: validation_rule_setsSlice,
validation_rules: validation_rulesSlice,
import_row_results: import_row_resultsSlice,
import_issues: import_issuesSlice,
import_templates: import_templatesSlice,
products: productsSlice,
customers: customersSlice,
suppliers: suppliersSlice,
availability_records: availability_recordsSlice,
audit_events: audit_eventsSlice,
  },
})

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