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 system_parametersSlice from "./system_parameters/system_parametersSlice";
import holidaysSlice from "./holidays/holidaysSlice";
import sss_contribution_tablesSlice from "./sss_contribution_tables/sss_contribution_tablesSlice";
import withholding_tax_tablesSlice from "./withholding_tax_tables/withholding_tax_tablesSlice";
import fiscal_periodsSlice from "./fiscal_periods/fiscal_periodsSlice";
import cost_centersSlice from "./cost_centers/cost_centersSlice";
import departmentsSlice from "./departments/departmentsSlice";
import positionsSlice from "./positions/positionsSlice";
import shiftsSlice from "./shifts/shiftsSlice";
import employeesSlice from "./employees/employeesSlice";
import employee_documentsSlice from "./employee_documents/employee_documentsSlice";
import time_recordsSlice from "./time_records/time_recordsSlice";
import biometric_importsSlice from "./biometric_imports/biometric_importsSlice";
import leave_typesSlice from "./leave_types/leave_typesSlice";
import leave_balancesSlice from "./leave_balances/leave_balancesSlice";
import leave_applicationsSlice from "./leave_applications/leave_applicationsSlice";
import employee_loansSlice from "./employee_loans/employee_loansSlice";
import loan_deductionsSlice from "./loan_deductions/loan_deductionsSlice";
import payroll_runsSlice from "./payroll_runs/payroll_runsSlice";
import payroll_itemsSlice from "./payroll_items/payroll_itemsSlice";
import bank_filesSlice from "./bank_files/bank_filesSlice";
import accountsSlice from "./accounts/accountsSlice";
import journal_entriesSlice from "./journal_entries/journal_entriesSlice";
import journal_linesSlice from "./journal_lines/journal_linesSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import ap_invoicesSlice from "./ap_invoices/ap_invoicesSlice";
import ap_paymentsSlice from "./ap_payments/ap_paymentsSlice";
import ap_payment_linesSlice from "./ap_payment_lines/ap_payment_linesSlice";
import customersSlice from "./customers/customersSlice";
import ar_invoicesSlice from "./ar_invoices/ar_invoicesSlice";
import ar_invoice_itemsSlice from "./ar_invoice_items/ar_invoice_itemsSlice";
import job_requisitionsSlice from "./job_requisitions/job_requisitionsSlice";
import applicantsSlice from "./applicants/applicantsSlice";
import approval_requestsSlice from "./approval_requests/approval_requestsSlice";
import notificationsSlice from "./notifications/notificationsSlice";
import export_requestsSlice from "./export_requests/export_requestsSlice";
import password_historiesSlice from "./password_histories/password_historiesSlice";
import refresh_tokensSlice from "./refresh_tokens/refresh_tokensSlice";
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,
system_parameters: system_parametersSlice,
holidays: holidaysSlice,
sss_contribution_tables: sss_contribution_tablesSlice,
withholding_tax_tables: withholding_tax_tablesSlice,
fiscal_periods: fiscal_periodsSlice,
cost_centers: cost_centersSlice,
departments: departmentsSlice,
positions: positionsSlice,
shifts: shiftsSlice,
employees: employeesSlice,
employee_documents: employee_documentsSlice,
time_records: time_recordsSlice,
biometric_imports: biometric_importsSlice,
leave_types: leave_typesSlice,
leave_balances: leave_balancesSlice,
leave_applications: leave_applicationsSlice,
employee_loans: employee_loansSlice,
loan_deductions: loan_deductionsSlice,
payroll_runs: payroll_runsSlice,
payroll_items: payroll_itemsSlice,
bank_files: bank_filesSlice,
accounts: accountsSlice,
journal_entries: journal_entriesSlice,
journal_lines: journal_linesSlice,
vendors: vendorsSlice,
ap_invoices: ap_invoicesSlice,
ap_payments: ap_paymentsSlice,
ap_payment_lines: ap_payment_linesSlice,
customers: customersSlice,
ar_invoices: ar_invoicesSlice,
ar_invoice_items: ar_invoice_itemsSlice,
job_requisitions: job_requisitionsSlice,
applicants: applicantsSlice,
approval_requests: approval_requestsSlice,
notifications: notificationsSlice,
export_requests: export_requestsSlice,
password_histories: password_historiesSlice,
refresh_tokens: refresh_tokensSlice,
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
