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 billing_customersSlice from "./billing_customers/billing_customersSlice";
import subscriptionsSlice from "./subscriptions/subscriptionsSlice";
import trading_accountsSlice from "./trading_accounts/trading_accountsSlice";
import instrumentsSlice from "./instruments/instrumentsSlice";
import setupsSlice from "./setups/setupsSlice";
import tagsSlice from "./tags/tagsSlice";
import tradesSlice from "./trades/tradesSlice";
import trade_attachmentsSlice from "./trade_attachments/trade_attachmentsSlice";
import trade_rulesSlice from "./trade_rules/trade_rulesSlice";
import trade_rule_checksSlice from "./trade_rule_checks/trade_rule_checksSlice";
import mood_entriesSlice from "./mood_entries/mood_entriesSlice";
import goalsSlice from "./goals/goalsSlice";
import milestonesSlice from "./milestones/milestonesSlice";
import watchlist_itemsSlice from "./watchlist_items/watchlist_itemsSlice";
import economic_eventsSlice from "./economic_events/economic_eventsSlice";
import csv_import_jobsSlice from "./csv_import_jobs/csv_import_jobsSlice";
import csv_import_row_errorsSlice from "./csv_import_row_errors/csv_import_row_errorsSlice";
import broker_connectionsSlice from "./broker_connections/broker_connectionsSlice";
import trade_sync_runsSlice from "./trade_sync_runs/trade_sync_runsSlice";
import ai_insight_runsSlice from "./ai_insight_runs/ai_insight_runsSlice";
import ai_insight_itemsSlice from "./ai_insight_items/ai_insight_itemsSlice";
import alert_rulesSlice from "./alert_rules/alert_rulesSlice";
import alertsSlice from "./alerts/alertsSlice";
import dashboard_widgetsSlice from "./dashboard_widgets/dashboard_widgetsSlice";
import pdf_reportsSlice from "./pdf_reports/pdf_reportsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
billing_customers: billing_customersSlice,
subscriptions: subscriptionsSlice,
trading_accounts: trading_accountsSlice,
instruments: instrumentsSlice,
setups: setupsSlice,
tags: tagsSlice,
trades: tradesSlice,
trade_attachments: trade_attachmentsSlice,
trade_rules: trade_rulesSlice,
trade_rule_checks: trade_rule_checksSlice,
mood_entries: mood_entriesSlice,
goals: goalsSlice,
milestones: milestonesSlice,
watchlist_items: watchlist_itemsSlice,
economic_events: economic_eventsSlice,
csv_import_jobs: csv_import_jobsSlice,
csv_import_row_errors: csv_import_row_errorsSlice,
broker_connections: broker_connectionsSlice,
trade_sync_runs: trade_sync_runsSlice,
ai_insight_runs: ai_insight_runsSlice,
ai_insight_items: ai_insight_itemsSlice,
alert_rules: alert_rulesSlice,
alerts: alertsSlice,
dashboard_widgets: dashboard_widgetsSlice,
pdf_reports: pdf_reportsSlice,
  },
})

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