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 departmentsSlice from "./departments/departmentsSlice";
import projectsSlice from "./projects/projectsSlice";
import budget_linesSlice from "./budget_lines/budget_linesSlice";
import workflow_rulesSlice from "./workflow_rules/workflow_rulesSlice";
import currency_ratesSlice from "./currency_rates/currency_ratesSlice";
import requisitionsSlice from "./requisitions/requisitionsSlice";
import approval_stepsSlice from "./approval_steps/approval_stepsSlice";
import procurement_casesSlice from "./procurement_cases/procurement_casesSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import supplier_categoriesSlice from "./supplier_categories/supplier_categoriesSlice";
import supplier_diligence_checksSlice from "./supplier_diligence_checks/supplier_diligence_checksSlice";
import tender_eventsSlice from "./tender_events/tender_eventsSlice";
import supplier_offersSlice from "./supplier_offers/supplier_offersSlice";
import bid_criteriaSlice from "./bid_criteria/bid_criteriaSlice";
import offer_scoresSlice from "./offer_scores/offer_scoresSlice";
import awardsSlice from "./awards/awardsSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import po_linesSlice from "./po_lines/po_linesSlice";
import goods_receipt_notesSlice from "./goods_receipt_notes/goods_receipt_notesSlice";
import grn_linesSlice from "./grn_lines/grn_linesSlice";
import service_acceptance_notesSlice from "./service_acceptance_notes/service_acceptance_notesSlice";
import discrepancy_casesSlice from "./discrepancy_cases/discrepancy_casesSlice";
import archive_itemsSlice from "./archive_items/archive_itemsSlice";
import access_logsSlice from "./access_logs/access_logsSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import audit_eventsSlice from "./audit_events/audit_eventsSlice";
import export_jobsSlice from "./export_jobs/export_jobsSlice";
import sessionsSlice from "./sessions/sessionsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
departments: departmentsSlice,
projects: projectsSlice,
budget_lines: budget_linesSlice,
workflow_rules: workflow_rulesSlice,
currency_rates: currency_ratesSlice,
requisitions: requisitionsSlice,
approval_steps: approval_stepsSlice,
procurement_cases: procurement_casesSlice,
suppliers: suppliersSlice,
supplier_categories: supplier_categoriesSlice,
supplier_diligence_checks: supplier_diligence_checksSlice,
tender_events: tender_eventsSlice,
supplier_offers: supplier_offersSlice,
bid_criteria: bid_criteriaSlice,
offer_scores: offer_scoresSlice,
awards: awardsSlice,
purchase_orders: purchase_ordersSlice,
po_lines: po_linesSlice,
goods_receipt_notes: goods_receipt_notesSlice,
grn_lines: grn_linesSlice,
service_acceptance_notes: service_acceptance_notesSlice,
discrepancy_cases: discrepancy_casesSlice,
archive_items: archive_itemsSlice,
access_logs: access_logsSlice,
notifications: notificationsSlice,
audit_events: audit_eventsSlice,
export_jobs: export_jobsSlice,
sessions: sessionsSlice,
  },
})

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