'use strict';

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

module.exports = function (app) {
  // Attestations collection routes
  app.route('/api/attestations').all(attestationsPolicy.isAllowed)
    .get(attestations.list)
    .post(attestations.create);
    
  // Single attestation routes
  app.route('/api/attestations/:attestationId').all(attestationsPolicy.isAllowed)
    .get(attestations.read)
    .put(attestations.update)
    .delete(attestations.delete);

  // Finish by binding the attestation middleware
  app.param('attestationId', attestations.attestationByID);
};
