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 workspacesSlice from "./workspaces/workspacesSlice";
import workspace_membershipsSlice from "./workspace_memberships/workspace_membershipsSlice";
import data_connectionsSlice from "./data_connections/data_connectionsSlice";
import financial_accountsSlice from "./financial_accounts/financial_accountsSlice";
import vendorsSlice from "./vendors/vendorsSlice";
import customersSlice from "./customers/customersSlice";
import transactionsSlice from "./transactions/transactionsSlice";
import budgetsSlice from "./budgets/budgetsSlice";
import budget_linesSlice from "./budget_lines/budget_linesSlice";
import forecastsSlice from "./forecasts/forecastsSlice";
import forecast_scenariosSlice from "./forecast_scenarios/forecast_scenariosSlice";
import metrics_snapshotsSlice from "./metrics_snapshots/metrics_snapshotsSlice";
import anomaliesSlice from "./anomalies/anomaliesSlice";
import alertsSlice from "./alerts/alertsSlice";
import recommendationsSlice from "./recommendations/recommendationsSlice";
import chat_threadsSlice from "./chat_threads/chat_threadsSlice";
import chat_messagesSlice from "./chat_messages/chat_messagesSlice";
import message_citationsSlice from "./message_citations/message_citationsSlice";
import files_librarySlice from "./files_library/files_librarySlice";
import sync_jobsSlice from "./sync_jobs/sync_jobsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
workspaces: workspacesSlice,
workspace_memberships: workspace_membershipsSlice,
data_connections: data_connectionsSlice,
financial_accounts: financial_accountsSlice,
vendors: vendorsSlice,
customers: customersSlice,
transactions: transactionsSlice,
budgets: budgetsSlice,
budget_lines: budget_linesSlice,
forecasts: forecastsSlice,
forecast_scenarios: forecast_scenariosSlice,
metrics_snapshots: metrics_snapshotsSlice,
anomalies: anomaliesSlice,
alerts: alertsSlice,
recommendations: recommendationsSlice,
chat_threads: chat_threadsSlice,
chat_messages: chat_messagesSlice,
message_citations: message_citationsSlice,
files_library: files_librarySlice,
sync_jobs: sync_jobsSlice,
  },
})

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