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 tenantsSlice from "./tenants/tenantsSlice";
import farmsSlice from "./farms/farmsSlice";
import trialsSlice from "./trials/trialsSlice";
import projectsSlice from "./projects/projectsSlice";
import trial_sitesSlice from "./trial_sites/trial_sitesSlice";
import varietiesSlice from "./varieties/varietiesSlice";
import trial_entriesSlice from "./trial_entries/trial_entriesSlice";
import plotsSlice from "./plots/plotsSlice";
import plantsSlice from "./plants/plantsSlice";
import observation_eventsSlice from "./observation_events/observation_eventsSlice";
import traitsSlice from "./traits/traitsSlice";
import observationsSlice from "./observations/observationsSlice";
import media_assetsSlice from "./media_assets/media_assetsSlice";
import report_templatesSlice from "./report_templates/report_templatesSlice";
import reportsSlice from "./reports/reportsSlice";
import api_clientsSlice from "./api_clients/api_clientsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
tenants: tenantsSlice,
farms: farmsSlice,
trials: trialsSlice,
projects: projectsSlice,
trial_sites: trial_sitesSlice,
varieties: varietiesSlice,
trial_entries: trial_entriesSlice,
plots: plotsSlice,
plants: plantsSlice,
observation_events: observation_eventsSlice,
traits: traitsSlice,
observations: observationsSlice,
media_assets: media_assetsSlice,
report_templates: report_templatesSlice,
reports: reportsSlice,
api_clients: api_clientsSlice,
  },
})

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