import * as Redux from 'redux'
import reducer from './reducer'
import thunk from 'redux-thunk'
import { lazyReducerEnhancer } from 'pwa-helpers/lazy-reducer-enhancer.js'

export { navigate, updateDrawerState, followRouteChange, setRoute } from './actions/actions-route'

export { fetchBoardList, fetchBoard, createBoard, updateBoard, deleteBoard } from './actions/actions-board'

export { fetchGroupList, createGroup, deleteGroup, updateGroup, joinGroup } from './actions/actions-group'

export {
  fetchPlayGroupList,
  createPlayGroup,
  updatePlayGroup,
  deletePlayGroup,
  joinPlayGroup,
  leavePlayGroup
} from './actions/actions-play-group'

export { fetchSettingList } from './actions/actions-setting'

export { createDataSource, updateDataSource, deleteDataSource, fetchDataSourceList } from './actions/actions-datasource'

export { createPublisher, updatePublisher, deletePublisher, fetchPublisherList } from './actions/actions-publisher'

export { createFont, updateFont, deleteFont, fetchFontList } from './actions/actions-font'

export { uploadFile, fetchFileList } from './actions/actions-file'

export { showContextmenu, hideContextmenu } from './actions/actions-contextmenu'

export { updateOffline } from './actions/actions-offline'

export { signin, signup, signout, authcheck } from './actions/actions-auth'

// Sets up a Chrome extension for time travel debugging.
// See https://github.com/zalmoxisus/redux-devtools-extension for more information.
const devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || Redux.compose

// Initializes the Redux store with a lazyReducerEnhancer (so that you can
// lazily add reducers after the store has been created) and redux-thunk (so
// that you can dispatch async actions). See the "Redux and state management"
// section of the wiki for more details:
// https://github.com/Polymer/pwa-starter-kit/wiki/4.-Redux-and-state-management
export const store = Redux.createStore(
  state => state,
  devCompose(lazyReducerEnhancer(Redux.combineReducers), Redux.applyMiddleware(thunk))
)

// Initially loaded reducers.
store.addReducers(reducer)
