'use strict';

/**
 * Module dependencies.
 */
var infrastructureRequestsPolicy = require('../policies/infrastructureRequests.server.policy'),
  infrastructureRequests = require('../controllers/infrastructureRequests.server.controller');

module.exports = function (app) {
  // InfrastructureRequests collection routes
  app.route('/api/infrastructureRequests').all(infrastructureRequestsPolicy.isAllowed)
    .get(infrastructureRequests.list)
    .post(infrastructureRequests.create);

  // Single infrastructureRequest routes
  app.route('/api/infrastructureRequests/:infrastructureRequestId').all(infrastructureRequestsPolicy.isAllowed)
    .get(infrastructureRequests.read)
    .put(infrastructureRequests.update)
    .delete(infrastructureRequests.delete);

  // Finish by binding the infrastructureRequest middleware
  app.param('infrastructureRequestId', infrastructureRequests.infrastructureRequestByID);
};
