import {
  type Action,
  combineSlices,
  configureStore,
  type ThunkAction,
} from '@reduxjs/toolkit';
import { booksSlice } from '../features/books/booksSlice';

export const store = configureStore({
  reducer: combineSlices(booksSlice),
  devTools: true,
});

export type RootState = ReturnType<typeof store.getState>;
export type AppStore = typeof store;
export type AppDispatch = AppStore['dispatch'];
export type AppThunk<ThunkReturnType = void> = ThunkAction<
  ThunkReturnType,
  RootState,
  unknown,
  Action
>;
