import {configureStore, getDefaultMiddleware} from 'redux-starter-kit';
import {createCommonReducer} from '../reducers/common_reducer';
import {downloadReducer} from '../reducers/download_reducer';
import {errorReducer} from '../reducers/error_reducer';
import {installReducer} from '../reducers/install_reducer';
import {mountReducer} from '../reducers/mount_reducer';
import {releaseVersionReducer} from '../reducers/release_version_reducer';

export default function createAppStore(platform, appPlatform, version) {
  const reducer = {
    common: createCommonReducer(platform, appPlatform, version),
    download: downloadReducer,
    error: errorReducer,
    install: installReducer,
    mounts: mountReducer,
    relver: releaseVersionReducer,
  };

  const middleware = [...getDefaultMiddleware()];

  return configureStore({
    reducer,
    middleware,
    devTools: process.env.NODE_ENV !== 'production'
  });
}