import { configureStore } from "@reduxjs/toolkit";
import { authReducer } from "auth/data/authReducer";
import { servicesReducer } from "services/data/servicesReducer";
import { uiReducer } from "ui/data/uiReducer";
import { userReducer } from "user/data/userReducer";
import thunk from "redux-thunk";
import { subscriptionsReducer } from "subscriptions/data/subscriptionsReducer";

const store = configureStore({
  reducer: {
    user: userReducer,
    ui: uiReducer,
    services: servicesReducer,
    auth: authReducer,
    subscriptions: subscriptionsReducer,
  },
  middleware: [
    thunk,
  ]
});

export {store};

export type RootState = ReturnType<typeof store.getState>;

export type AppDispatch = typeof store.dispatch;
