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 companiesSlice from "./companies/companiesSlice";
import user_role_assignmentsSlice from "./user_role_assignments/user_role_assignmentsSlice";
import role_permission_mappingsSlice from "./role_permission_mappings/role_permission_mappingsSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import product_categoriesSlice from "./product_categories/product_categoriesSlice";
import productsSlice from "./products/productsSlice";
import purchase_requisitionsSlice from "./purchase_requisitions/purchase_requisitionsSlice";
import purchase_requisition_linesSlice from "./purchase_requisition_lines/purchase_requisition_linesSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_linesSlice from "./purchase_order_lines/purchase_order_linesSlice";
import goods_receiptsSlice from "./goods_receipts/goods_receiptsSlice";
import goods_receipt_linesSlice from "./goods_receipt_lines/goods_receipt_linesSlice";
import vendor_invoicesSlice from "./vendor_invoices/vendor_invoicesSlice";
import invoice_linesSlice from "./invoice_lines/invoice_linesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import departmentsSlice from "./departments/departmentsSlice";
import document_typesSlice from "./document_types/document_typesSlice";
import documentsSlice from "./documents/documentsSlice";
import document_linksSlice from "./document_links/document_linksSlice";
import approval_workflowsSlice from "./approval_workflows/approval_workflowsSlice";
import approval_stepsSlice from "./approval_steps/approval_stepsSlice";
import approvalsSlice from "./approvals/approvalsSlice";
import activity_logsSlice from "./activity_logs/activity_logsSlice";
import ui_announcementsSlice from "./ui_announcements/ui_announcementsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
companies: companiesSlice,
user_role_assignments: user_role_assignmentsSlice,
role_permission_mappings: role_permission_mappingsSlice,
vendors: vendorsSlice,
warehouses: warehousesSlice,
product_categories: product_categoriesSlice,
products: productsSlice,
purchase_requisitions: purchase_requisitionsSlice,
purchase_requisition_lines: purchase_requisition_linesSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
goods_receipts: goods_receiptsSlice,
goods_receipt_lines: goods_receipt_linesSlice,
vendor_invoices: vendor_invoicesSlice,
invoice_lines: invoice_linesSlice,
payments: paymentsSlice,
departments: departmentsSlice,
document_types: document_typesSlice,
documents: documentsSlice,
document_links: document_linksSlice,
approval_workflows: approval_workflowsSlice,
approval_steps: approval_stepsSlice,
approvals: approvalsSlice,
activity_logs: activity_logsSlice,
ui_announcements: ui_announcementsSlice,
  },
})

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