import { configureStore } from '@reduxjs/toolkit';
import styleReducer from './styleSlice';
import mainReducer from './mainSlice';
import authSlice from './authSlice';
import openAiSlice from './openAiSlice';
import dashboardReducer from './dashboardSlice';
import contextSlice from './contextSlice';

import usersSlice from "./users/usersSlice";
import rolesSlice from "./roles/rolesSlice";
import permissionsSlice from "./permissions/permissionsSlice";
import organizationsSlice from "./organizations/organizationsSlice";
import firmsSlice from "./firms/firmsSlice";
import merchantsSlice from "./merchants/merchantsSlice";
import customersSlice from "./customers/customersSlice";
import suppliersSlice from "./suppliers/suppliersSlice";
import productsSlice from "./products/productsSlice";
import receiptsSlice from "./receipts/receiptsSlice";
import ocr_extractionsSlice from "./ocr_extractions/ocr_extractionsSlice";
import sales_invoicesSlice from "./sales_invoices/sales_invoicesSlice";
import sales_invoice_linesSlice from "./sales_invoice_lines/sales_invoice_linesSlice";
import purchase_invoicesSlice from "./purchase_invoices/purchase_invoicesSlice";
import purchase_invoice_linesSlice from "./purchase_invoice_lines/purchase_invoice_linesSlice";
import expensesSlice from "./expenses/expensesSlice";
import tax_periodsSlice from "./tax_periods/tax_periodsSlice";
import vat_declarationsSlice from "./vat_declarations/vat_declarationsSlice";
import tot_declarationsSlice from "./tot_declarations/tot_declarationsSlice";
import declaration_submissionsSlice from "./declaration_submissions/declaration_submissionsSlice";
import messagesSlice from "./messages/messagesSlice";
import audit_eventsSlice from "./audit_events/audit_eventsSlice";
import transactionsSlice from "./transactions/transactionsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
firms: firmsSlice,
merchants: merchantsSlice,
customers: customersSlice,
suppliers: suppliersSlice,
products: productsSlice,
receipts: receiptsSlice,
ocr_extractions: ocr_extractionsSlice,
sales_invoices: sales_invoicesSlice,
sales_invoice_lines: sales_invoice_linesSlice,
purchase_invoices: purchase_invoicesSlice,
purchase_invoice_lines: purchase_invoice_linesSlice,
expenses: expensesSlice,
tax_periods: tax_periodsSlice,
vat_declarations: vat_declarationsSlice,
tot_declarations: tot_declarationsSlice,
declaration_submissions: declaration_submissionsSlice,
messages: messagesSlice,
audit_events: audit_eventsSlice,
transactions: transactionsSlice,
  },
})

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