/**
 * 版本管理路由
 *
 * @author CaiAoLin
 * @date 2017/7/28
 * @version
 */
import Express from "express";
import CompilationController from "../controllers/compilation_controller";

const router = Express.Router();
const compilationController = new CompilationController();
module.exports = function (app) {
    // action定义区域
    router.get('/', compilationController.auth, compilationController.init, compilationController.index);
    router.get('/valuation/:section/:id', compilationController.auth, compilationController.init, compilationController.editValuation);
    router.get('/:section/:id/:engineerID', compilationController.auth, compilationController.init, compilationController.editEngineering);
    router.get('/valuation/:section/delete/:id', compilationController.auth, compilationController.init, compilationController.deleteValuation);
    router.get('/template/:section/:id/:engineering', compilationController.auth, compilationController.init, compilationController.billsTemplate);

    router.post('/release', compilationController.auth, compilationController.init, compilationController.release);
    router.post('/add', compilationController.auth, compilationController.init, compilationController.addCompilation);
    router.post('/setDescription', compilationController.auth, compilationController.init, compilationController.setDescription);
    router.post('/setOverWriteUrl', compilationController.auth, compilationController.init, compilationController.setOverWriteUrl);
    router.post('/setExample', compilationController.auth, compilationController.init, compilationController.setExample);
    router.post('/add-valuation', compilationController.auth, compilationController.init, compilationController.addValuation);
    router.post('/save-valuation', compilationController.auth, compilationController.init, compilationController.saveValuation);
    router.post('/update-engineer', compilationController.auth, compilationController.init, compilationController.updateEngineer);
    router.post('/delete-engineer', compilationController.auth, compilationController.init, compilationController.deleteEngineer);
    router.post('/save-lib', compilationController.auth, compilationController.init, compilationController.saveEngineering);
    router.post('/valuation/:section/enable', compilationController.auth, compilationController.init, compilationController.enableSwitch);
    router.post('/template/:section/:id/:engineering/update', compilationController.auth, compilationController.init, compilationController.updateBillsTemplate);
    router.post('/addEngineer', compilationController.auth, compilationController.init, compilationController.addEngineer);

    router.post('/changeCategory', compilationController.auth, compilationController.init, compilationController.changeCategory);

    app.use("/compilation", router);
};
