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 membershipsSlice from "./memberships/membershipsSlice";
import role_assignmentsSlice from "./role_assignments/role_assignmentsSlice";
import approval_workflowsSlice from "./approval_workflows/approval_workflowsSlice";
import approval_stepsSlice from "./approval_steps/approval_stepsSlice";
import approval_requestsSlice from "./approval_requests/approval_requestsSlice";
import approval_decisionsSlice from "./approval_decisions/approval_decisionsSlice";
import companiesSlice from "./companies/companiesSlice";
import customersSlice from "./customers/customersSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import uomsSlice from "./uoms/uomsSlice";
import item_categoriesSlice from "./item_categories/item_categoriesSlice";
import itemsSlice from "./items/itemsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import locationsSlice from "./locations/locationsSlice";
import lotsSlice from "./lots/lotsSlice";
import serial_numbersSlice from "./serial_numbers/serial_numbersSlice";
import inventory_transfersSlice from "./inventory_transfers/inventory_transfersSlice";
import inventory_transfer_linesSlice from "./inventory_transfer_lines/inventory_transfer_linesSlice";
import stock_movementsSlice from "./stock_movements/stock_movementsSlice";
import quotationsSlice from "./quotations/quotationsSlice";
import quotation_linesSlice from "./quotation_lines/quotation_linesSlice";
import sales_ordersSlice from "./sales_orders/sales_ordersSlice";
import sales_order_linesSlice from "./sales_order_lines/sales_order_linesSlice";
import sales_allocationsSlice from "./sales_allocations/sales_allocationsSlice";
import invoicesSlice from "./invoices/invoicesSlice";
import invoice_linesSlice from "./invoice_lines/invoice_linesSlice";
import customer_returnsSlice from "./customer_returns/customer_returnsSlice";
import customer_return_linesSlice from "./customer_return_lines/customer_return_linesSlice";
import purchase_ordersSlice from "./purchase_orders/purchase_ordersSlice";
import purchase_order_linesSlice from "./purchase_order_lines/purchase_order_linesSlice";
import receiptsSlice from "./receipts/receiptsSlice";
import receipt_linesSlice from "./receipt_lines/receipt_linesSlice";
import vendor_billsSlice from "./vendor_bills/vendor_billsSlice";
import vendor_bill_linesSlice from "./vendor_bill_lines/vendor_bill_linesSlice";
import chart_of_accountsSlice from "./chart_of_accounts/chart_of_accountsSlice";
import fiscal_periodsSlice from "./fiscal_periods/fiscal_periodsSlice";
import journal_entriesSlice from "./journal_entries/journal_entriesSlice";
import journal_linesSlice from "./journal_lines/journal_linesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import tax_ratesSlice from "./tax_rates/tax_ratesSlice";
import webhooksSlice from "./webhooks/webhooksSlice";
import webhook_subscriptionsSlice from "./webhook_subscriptions/webhook_subscriptionsSlice";
import webhook_deliveriesSlice from "./webhook_deliveries/webhook_deliveriesSlice";
import email_notificationsSlice from "./email_notifications/email_notificationsSlice";
import csv_import_jobsSlice from "./csv_import_jobs/csv_import_jobsSlice";
import reportsSlice from "./reports/reportsSlice";
import dashboardsSlice from "./dashboards/dashboardsSlice";
import dashboard_widgetsSlice from "./dashboard_widgets/dashboard_widgetsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
memberships: membershipsSlice,
role_assignments: role_assignmentsSlice,
approval_workflows: approval_workflowsSlice,
approval_steps: approval_stepsSlice,
approval_requests: approval_requestsSlice,
approval_decisions: approval_decisionsSlice,
companies: companiesSlice,
customers: customersSlice,
suppliers: suppliersSlice,
uoms: uomsSlice,
item_categories: item_categoriesSlice,
items: itemsSlice,
warehouses: warehousesSlice,
locations: locationsSlice,
lots: lotsSlice,
serial_numbers: serial_numbersSlice,
inventory_transfers: inventory_transfersSlice,
inventory_transfer_lines: inventory_transfer_linesSlice,
stock_movements: stock_movementsSlice,
quotations: quotationsSlice,
quotation_lines: quotation_linesSlice,
sales_orders: sales_ordersSlice,
sales_order_lines: sales_order_linesSlice,
sales_allocations: sales_allocationsSlice,
invoices: invoicesSlice,
invoice_lines: invoice_linesSlice,
customer_returns: customer_returnsSlice,
customer_return_lines: customer_return_linesSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
receipts: receiptsSlice,
receipt_lines: receipt_linesSlice,
vendor_bills: vendor_billsSlice,
vendor_bill_lines: vendor_bill_linesSlice,
chart_of_accounts: chart_of_accountsSlice,
fiscal_periods: fiscal_periodsSlice,
journal_entries: journal_entriesSlice,
journal_lines: journal_linesSlice,
payments: paymentsSlice,
tax_rates: tax_ratesSlice,
webhooks: webhooksSlice,
webhook_subscriptions: webhook_subscriptionsSlice,
webhook_deliveries: webhook_deliveriesSlice,
email_notifications: email_notificationsSlice,
csv_import_jobs: csv_import_jobsSlice,
reports: reportsSlice,
dashboards: dashboardsSlice,
dashboard_widgets: dashboard_widgetsSlice,
  },
})

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