'use strict'

var express = require('express');
var router = express.Router();
var md_auth = require('../middleware/authenticated');
var cargoCtrl = require('../controllers/cargo');
var areaCtrl  = require('../controllers/area');

router.get   ('/cargos',                 md_auth.ensureAuth, cargoCtrl.listarCargos);
router.get   ('/cargos/:id',             md_auth.ensureAuth, cargoCtrl.obtenerCargo);
router.post  ('/cargos',                 md_auth.ensureAuth, cargoCtrl.registrarCargo);
router.put   ('/cargos/:id',             md_auth.ensureAuth, cargoCtrl.actualizarCargo);
router.put   ('/cargos/:id/estado',      md_auth.ensureAuth, cargoCtrl.cambiarEstadoCargo);

router.get   ('/areas',                  md_auth.ensureAuth, areaCtrl.listarAreas);
router.post  ('/areas',                  md_auth.ensureAuth, areaCtrl.registrarArea);
router.put   ('/areas/:id',              md_auth.ensureAuth, areaCtrl.actualizarArea);
router.put   ('/areas/:id/estado',       md_auth.ensureAuth, areaCtrl.cambiarEstadoArea);

module.exports = router;
