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 provincesSlice from "./provinces/provincesSlice";
import departmentsSlice from "./departments/departmentsSlice";
import role_permissionsSlice from "./role_permissions/role_permissionsSlice";
import approval_workflowsSlice from "./approval_workflows/approval_workflowsSlice";
import approval_stepsSlice from "./approval_steps/approval_stepsSlice";
import approvalsSlice from "./approvals/approvalsSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import fiscal_yearsSlice from "./fiscal_years/fiscal_yearsSlice";
import funding_sourcesSlice from "./funding_sources/funding_sourcesSlice";
import budget_programsSlice from "./budget_programs/budget_programsSlice";
import budget_linesSlice from "./budget_lines/budget_linesSlice";
import allocationsSlice from "./allocations/allocationsSlice";
import budget_reallocationsSlice from "./budget_reallocations/budget_reallocationsSlice";
import procurement_plansSlice from "./procurement_plans/procurement_plansSlice";
import requisitionsSlice from "./requisitions/requisitionsSlice";
import tendersSlice from "./tenders/tendersSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import vendor_compliance_documentsSlice from "./vendor_compliance_documents/vendor_compliance_documentsSlice";
import bidsSlice from "./bids/bidsSlice";
import bid_evaluationsSlice from "./bid_evaluations/bid_evaluationsSlice";
import awardsSlice from "./awards/awardsSlice";
import programsSlice from "./programs/programsSlice";
import projectsSlice from "./projects/projectsSlice";
import project_milestonesSlice from "./project_milestones/project_milestonesSlice";
import risksSlice from "./risks/risksSlice";
import issuesSlice from "./issues/issuesSlice";
import field_verificationsSlice from "./field_verifications/field_verificationsSlice";
import contractsSlice from "./contracts/contractsSlice";
import contract_amendmentsSlice from "./contract_amendments/contract_amendmentsSlice";
import contract_milestonesSlice from "./contract_milestones/contract_milestonesSlice";
import grantsSlice from "./grants/grantsSlice";
import beneficiariesSlice from "./beneficiaries/beneficiariesSlice";
import grant_applicationsSlice from "./grant_applications/grant_applicationsSlice";
import grant_evaluationsSlice from "./grant_evaluations/grant_evaluationsSlice";
import grant_tranchesSlice from "./grant_tranches/grant_tranchesSlice";
import expense_categoriesSlice from "./expense_categories/expense_categoriesSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import payment_requestsSlice from "./payment_requests/payment_requestsSlice";
import payment_batchesSlice from "./payment_batches/payment_batchesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import obligationsSlice from "./obligations/obligationsSlice";
import ledger_entriesSlice from "./ledger_entries/ledger_entriesSlice";
import documentsSlice from "./documents/documentsSlice";
import compliance_alertsSlice from "./compliance_alerts/compliance_alertsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
provinces: provincesSlice,
departments: departmentsSlice,
role_permissions: role_permissionsSlice,
approval_workflows: approval_workflowsSlice,
approval_steps: approval_stepsSlice,
approvals: approvalsSlice,
notifications: notificationsSlice,
audit_logs: audit_logsSlice,
fiscal_years: fiscal_yearsSlice,
funding_sources: funding_sourcesSlice,
budget_programs: budget_programsSlice,
budget_lines: budget_linesSlice,
allocations: allocationsSlice,
budget_reallocations: budget_reallocationsSlice,
procurement_plans: procurement_plansSlice,
requisitions: requisitionsSlice,
tenders: tendersSlice,
vendors: vendorsSlice,
vendor_compliance_documents: vendor_compliance_documentsSlice,
bids: bidsSlice,
bid_evaluations: bid_evaluationsSlice,
awards: awardsSlice,
programs: programsSlice,
projects: projectsSlice,
project_milestones: project_milestonesSlice,
risks: risksSlice,
issues: issuesSlice,
field_verifications: field_verificationsSlice,
contracts: contractsSlice,
contract_amendments: contract_amendmentsSlice,
contract_milestones: contract_milestonesSlice,
grants: grantsSlice,
beneficiaries: beneficiariesSlice,
grant_applications: grant_applicationsSlice,
grant_evaluations: grant_evaluationsSlice,
grant_tranches: grant_tranchesSlice,
expense_categories: expense_categoriesSlice,
invoices: invoicesSlice,
payment_requests: payment_requestsSlice,
payment_batches: payment_batchesSlice,
payments: paymentsSlice,
obligations: obligationsSlice,
ledger_entries: ledger_entriesSlice,
documents: documentsSlice,
compliance_alerts: compliance_alertsSlice,
  },
})

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