import {configureStore} from '@reduxjs/toolkit';

import authReducer from 'features/auth/authSlice';
import interfaceReducer from 'features/interface/interfaceSlice';
import scanModalReducer from 'features/scanModal/scanModalSlice';
import loadingModalReducer from 'features/loadingModal/loadingModalSlice';
import imageZoomModalReducer from 'features/imageZoomModal/loadingModalSlice';
import assemblyReducer from 'features/assembly/assemblySlice';
import printingReducer from 'features/printing/printingSlice';
import reprintModalReducer from 'features/reprintModal/reprintModalSlice';
import ordersFilterReducer from 'features/ordersFilter/ordersFilterSlice';
import shippingWarehouseSelectReducer from 'features/shippingWarehouseSelect/shippingWarehouseSelectSlice';
import citySelectReducer from 'features/citySelect/citySelectSlice';
import {useDispatch} from "react-redux";

export const store = configureStore({
    reducer: {
        auth: authReducer,
        interface: interfaceReducer,
        scanModal: scanModalReducer,
        loadingModal: loadingModalReducer,
        assembly: assemblyReducer,
        printing: printingReducer,
        reprintModal: reprintModalReducer,
        imageZoomModal: imageZoomModalReducer,
        ordersFilter: ordersFilterReducer,
        shippingWarehouseSelect: shippingWarehouseSelectReducer,
        citySelect: citySelectReducer
    },
});

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
export const useAppDispatch = () => useDispatch<AppDispatch>();