// load routes
const topRoutes = require('./toplevel');
const testRoutes = require('./test');
const hardwareRoutes = require('./hardware');
const benchmarkRoutes = require('./benchmark');
const apiv1Routes = require('./api_v1');

module.exports = function(app) {

  // top-level routes
  app.get('/', topRoutes.getIndex);

  // hardware routes
  app.get('/hardware', hardwareRoutes.getIndex);
  app.get('/hardware/list', hardwareRoutes.getList);
  app.get('/hardware/add', hardwareRoutes.getAdd);
  app.post('/hardware/add', hardwareRoutes.postAdd);
  app.get('/hardware/:hardware_id', hardwareRoutes.getView);

  // benchmark routes
  app.get('/benchmark', benchmarkRoutes.getIndex);
  app.get('/benchmark/list', benchmarkRoutes.getList);
  app.get('/benchmark/add', benchmarkRoutes.getAdd);
  app.post('/benchmark/add', benchmarkRoutes.postAdd);
  app.get('/benchmark/:benchmark_id', benchmarkRoutes.getView);

  // test routes
  app.get('/test', testRoutes.getIndex);
  app.get('/test/list', testRoutes.getList);
  app.get('/test/add', testRoutes.getAdd);
  app.post('/test/add', testRoutes.postAdd);
  app.get('/test/:test_id', testRoutes.getView);

  // API v1 routes
  app.get('/api/v1/benchmark/details', apiv1Routes.getBenchmarkDetails);
  app.get('/api/v1/result/list', apiv1Routes.getResultList);
  app.post('/api/v1/result/add', apiv1Routes.postResultAdd);

};
