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 branchesSlice from "./branches/branchesSlice";
import user_rolesSlice from "./user_roles/user_rolesSlice";
import audit_logsSlice from "./audit_logs/audit_logsSlice";
import product_categoriesSlice from "./product_categories/product_categoriesSlice";
import productsSlice from "./products/productsSlice";
import price_listsSlice from "./price_lists/price_listsSlice";
import price_list_itemsSlice from "./price_list_items/price_list_itemsSlice";
import warehousesSlice from "./warehouses/warehousesSlice";
import inventory_batchesSlice from "./inventory_batches/inventory_batchesSlice";
import inventory_transactionsSlice from "./inventory_transactions/inventory_transactionsSlice";
import stock_adjustmentsSlice from "./stock_adjustments/stock_adjustmentsSlice";
import stock_adjustment_linesSlice from "./stock_adjustment_lines/stock_adjustment_linesSlice";
import interbranch_transfersSlice from "./interbranch_transfers/interbranch_transfersSlice";
import transfer_linesSlice from "./transfer_lines/transfer_linesSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import supplier_productsSlice from "./supplier_products/supplier_productsSlice";
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 supplier_invoicesSlice from "./supplier_invoices/supplier_invoicesSlice";
import customersSlice from "./customers/customersSlice";
import loyalty_programsSlice from "./loyalty_programs/loyalty_programsSlice";
import pos_registersSlice from "./pos_registers/pos_registersSlice";
import pos_shiftsSlice from "./pos_shifts/pos_shiftsSlice";
import salesSlice from "./sales/salesSlice";
import sale_linesSlice from "./sale_lines/sale_linesSlice";
import paymentsSlice from "./payments/paymentsSlice";
import refundsSlice from "./refunds/refundsSlice";
import store_checklistsSlice from "./store_checklists/store_checklistsSlice";
import checklist_itemsSlice from "./checklist_items/checklist_itemsSlice";
import checklist_runsSlice from "./checklist_runs/checklist_runsSlice";
import checklist_run_itemsSlice from "./checklist_run_items/checklist_run_itemsSlice";
import risk_alertsSlice from "./risk_alerts/risk_alertsSlice";
import departmentsSlice from "./departments/departmentsSlice";
import employeesSlice from "./employees/employeesSlice";
import work_shiftsSlice from "./work_shifts/work_shiftsSlice";
import shift_assignmentsSlice from "./shift_assignments/shift_assignmentsSlice";
import attendance_recordsSlice from "./attendance_records/attendance_recordsSlice";
import payroll_runsSlice from "./payroll_runs/payroll_runsSlice";
import payroll_itemsSlice from "./payroll_items/payroll_itemsSlice";
import performance_reviewsSlice from "./performance_reviews/performance_reviewsSlice";
import chart_accountsSlice from "./chart_accounts/chart_accountsSlice";
import journal_entriesSlice from "./journal_entries/journal_entriesSlice";
import journal_linesSlice from "./journal_lines/journal_linesSlice";
import expensesSlice from "./expenses/expensesSlice";
import assetsSlice from "./assets/assetsSlice";
import marketing_campaignsSlice from "./marketing_campaigns/marketing_campaignsSlice";
import campaign_recipientsSlice from "./campaign_recipients/campaign_recipientsSlice";
import ai_reorder_suggestionsSlice from "./ai_reorder_suggestions/ai_reorder_suggestionsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
companies: companiesSlice,
branches: branchesSlice,
user_roles: user_rolesSlice,
audit_logs: audit_logsSlice,
product_categories: product_categoriesSlice,
products: productsSlice,
price_lists: price_listsSlice,
price_list_items: price_list_itemsSlice,
warehouses: warehousesSlice,
inventory_batches: inventory_batchesSlice,
inventory_transactions: inventory_transactionsSlice,
stock_adjustments: stock_adjustmentsSlice,
stock_adjustment_lines: stock_adjustment_linesSlice,
interbranch_transfers: interbranch_transfersSlice,
transfer_lines: transfer_linesSlice,
suppliers: suppliersSlice,
supplier_products: supplier_productsSlice,
purchase_orders: purchase_ordersSlice,
purchase_order_lines: purchase_order_linesSlice,
goods_receipts: goods_receiptsSlice,
goods_receipt_lines: goods_receipt_linesSlice,
supplier_invoices: supplier_invoicesSlice,
customers: customersSlice,
loyalty_programs: loyalty_programsSlice,
pos_registers: pos_registersSlice,
pos_shifts: pos_shiftsSlice,
sales: salesSlice,
sale_lines: sale_linesSlice,
payments: paymentsSlice,
refunds: refundsSlice,
store_checklists: store_checklistsSlice,
checklist_items: checklist_itemsSlice,
checklist_runs: checklist_runsSlice,
checklist_run_items: checklist_run_itemsSlice,
risk_alerts: risk_alertsSlice,
departments: departmentsSlice,
employees: employeesSlice,
work_shifts: work_shiftsSlice,
shift_assignments: shift_assignmentsSlice,
attendance_records: attendance_recordsSlice,
payroll_runs: payroll_runsSlice,
payroll_items: payroll_itemsSlice,
performance_reviews: performance_reviewsSlice,
chart_accounts: chart_accountsSlice,
journal_entries: journal_entriesSlice,
journal_lines: journal_linesSlice,
expenses: expensesSlice,
assets: assetsSlice,
marketing_campaigns: marketing_campaignsSlice,
campaign_recipients: campaign_recipientsSlice,
ai_reorder_suggestions: ai_reorder_suggestionsSlice,
  },
})

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