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 organization_membershipsSlice from "./organization_memberships/organization_membershipsSlice";
import projectsSlice from "./projects/projectsSlice";
import workspacesSlice from "./workspaces/workspacesSlice";
import llm_providersSlice from "./llm_providers/llm_providersSlice";
import llm_modelsSlice from "./llm_models/llm_modelsSlice";
import llm_api_keysSlice from "./llm_api_keys/llm_api_keysSlice";
import key_rotation_policiesSlice from "./key_rotation_policies/key_rotation_policiesSlice";
import prompt_templatesSlice from "./prompt_templates/prompt_templatesSlice";
import chatsSlice from "./chats/chatsSlice";
import chat_messagesSlice from "./chat_messages/chat_messagesSlice";
import encryption_sessionsSlice from "./encryption_sessions/encryption_sessionsSlice";
import code_repositoriesSlice from "./code_repositories/code_repositoriesSlice";
import code_filesSlice from "./code_files/code_filesSlice";
import code_change_setsSlice from "./code_change_sets/code_change_setsSlice";
import code_patchesSlice from "./code_patches/code_patchesSlice";
import build_jobsSlice from "./build_jobs/build_jobsSlice";
import build_pipelinesSlice from "./build_pipelines/build_pipelinesSlice";
import build_artifactsSlice from "./build_artifacts/build_artifactsSlice";
import web_search_queriesSlice from "./web_search_queries/web_search_queriesSlice";
import web_search_resultsSlice from "./web_search_results/web_search_resultsSlice";
import system_health_checksSlice from "./system_health_checks/system_health_checksSlice";
import audit_eventsSlice from "./audit_events/audit_eventsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
organization_memberships: organization_membershipsSlice,
projects: projectsSlice,
workspaces: workspacesSlice,
llm_providers: llm_providersSlice,
llm_models: llm_modelsSlice,
llm_api_keys: llm_api_keysSlice,
key_rotation_policies: key_rotation_policiesSlice,
prompt_templates: prompt_templatesSlice,
chats: chatsSlice,
chat_messages: chat_messagesSlice,
encryption_sessions: encryption_sessionsSlice,
code_repositories: code_repositoriesSlice,
code_files: code_filesSlice,
code_change_sets: code_change_setsSlice,
code_patches: code_patchesSlice,
build_jobs: build_jobsSlice,
build_pipelines: build_pipelinesSlice,
build_artifacts: build_artifactsSlice,
web_search_queries: web_search_queriesSlice,
web_search_results: web_search_resultsSlice,
system_health_checks: system_health_checksSlice,
audit_events: audit_eventsSlice,
  },
})

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