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 document_typesSlice from "./document_types/document_typesSlice";
import standardsSlice from "./standards/standardsSlice";
import clausesSlice from "./clauses/clausesSlice";
import document_templatesSlice from "./document_templates/document_templatesSlice";
import documentsSlice from "./documents/documentsSlice";
import document_versionsSlice from "./document_versions/document_versionsSlice";
import change_requestsSlice from "./change_requests/change_requestsSlice";
import approval_workflowsSlice from "./approval_workflows/approval_workflowsSlice";
import approval_stepsSlice from "./approval_steps/approval_stepsSlice";
import approval_tasksSlice from "./approval_tasks/approval_tasksSlice";
import esignature_eventsSlice from "./esignature_events/esignature_eventsSlice";
import training_coursesSlice from "./training_courses/training_coursesSlice";
import training_assignmentsSlice from "./training_assignments/training_assignmentsSlice";
import productsSlice from "./products/productsSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import batchesSlice from "./batches/batchesSlice";
import certificates_of_analysisSlice from "./certificates_of_analysis/certificates_of_analysisSlice";
import device_master_recordsSlice from "./device_master_records/device_master_recordsSlice";
import risk_assessmentsSlice from "./risk_assessments/risk_assessmentsSlice";
import risk_itemsSlice from "./risk_items/risk_itemsSlice";
import capasSlice from "./capas/capasSlice";
import nonconformancesSlice from "./nonconformances/nonconformancesSlice";
import complaintsSlice from "./complaints/complaintsSlice";
import auditsSlice from "./audits/auditsSlice";
import audit_findingsSlice from "./audit_findings/audit_findingsSlice";
import management_reviewsSlice from "./management_reviews/management_reviewsSlice";
import regulatory_submissionsSlice from "./regulatory_submissions/regulatory_submissionsSlice";
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,
document_types: document_typesSlice,
standards: standardsSlice,
clauses: clausesSlice,
document_templates: document_templatesSlice,
documents: documentsSlice,
document_versions: document_versionsSlice,
change_requests: change_requestsSlice,
approval_workflows: approval_workflowsSlice,
approval_steps: approval_stepsSlice,
approval_tasks: approval_tasksSlice,
esignature_events: esignature_eventsSlice,
training_courses: training_coursesSlice,
training_assignments: training_assignmentsSlice,
products: productsSlice,
suppliers: suppliersSlice,
batches: batchesSlice,
certificates_of_analysis: certificates_of_analysisSlice,
device_master_records: device_master_recordsSlice,
risk_assessments: risk_assessmentsSlice,
risk_items: risk_itemsSlice,
capas: capasSlice,
nonconformances: nonconformancesSlice,
complaints: complaintsSlice,
audits: auditsSlice,
audit_findings: audit_findingsSlice,
management_reviews: management_reviewsSlice,
regulatory_submissions: regulatory_submissionsSlice,
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
