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 projectsSlice from "./projects/projectsSlice";
import pagesSlice from "./pages/pagesSlice";
import componentsSlice from "./components/componentsSlice";
import layersSlice from "./layers/layersSlice";
import assetsSlice from "./assets/assetsSlice";
import versionsSlice from "./versions/versionsSlice";
import buildsSlice from "./builds/buildsSlice";
import stylesSlice from "./styles/stylesSlice";
import teamsSlice from "./teams/teamsSlice";

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

users: usersSlice,
roles: rolesSlice,
permissions: permissionsSlice,
organizations: organizationsSlice,
projects: projectsSlice,
pages: pagesSlice,
components: componentsSlice,
layers: layersSlice,
assets: assetsSlice,
versions: versionsSlice,
builds: buildsSlice,
styles: stylesSlice,
teams: teamsSlice,
  },
})

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