import DefaultLayout from 'layouts/DefaultLayout'
import { injectReducer } from 'store/reducers'

const route = (store) => ({
  getComponent (nextState, next) {
    require.ensure([], (require) => {
      const component = require('./containers/Metrics').default
      const reducer = require('./reducers/metrics_table').default
      injectReducer(store, {
        key: 'metrics_table',
        reducer: reducer
      })
      next(null, component)
    })
  }
})

export default (store) => ({
  path: 'metrics',
  component   : DefaultLayout,
  indexRoute  : route(store)
  // childRoutes: [
  //   OrgInfo(store)
  // ]
})
