/**
 * Created by Zhong on 2017/8/11.
 * 标准工料机库路由
 */

import express from "express";
import ViewsController from "../controllers/viewsController";
import GljMapController from "../controllers/gljMapController";
import GljController from "../controllers/gljController";

let router = express.Router();
let viewsController = new ViewsController(),
    gljMapController = new GljMapController(),
    gljController = new GljController();

module.exports = function (app) {
    app.get('/stdGljRepository/main', viewsController.auth, viewsController.init, viewsController.redirectMain);
    app.get('/stdGljRepository/glj', viewsController.auth, viewsController.init, viewsController.redirectGlj);

    router.get('/classTemplateCount/:compilationId', gljMapController.auth, gljMapController.init, gljMapController.classTemplateCount);
    router.post('/initClassTemplate', gljMapController.auth, gljMapController.init, gljMapController.initClassTemplate);
    router.post('/getCompilationList', gljMapController.auth, gljMapController.init, gljMapController.getCompilationList);
    router.post('/getGljLib', gljMapController.auth, gljMapController.init, gljMapController.getGljLib);
    router.post('/getAllGljLib', gljMapController.auth, gljMapController.init, gljMapController.getAllGljLib);
    router.post('/createGljLib', gljMapController.auth, gljMapController.init, gljMapController.createGljLib);
    router.post('/renameGljLib', gljMapController.auth, gljMapController.init, gljMapController.renameGljLib);
    router.post('/removeGljLib', gljMapController.auth, gljMapController.init, gljMapController.removeGljLib);

    router.post("/updateRationBasePrc",gljController.auth, gljController.init, gljController.updateRationBasePrc);//更新定额单价
    router.post("/getRationGljIds",gljController.auth, gljController.init, gljController.getRationGljIds);
    router.post("/createNewGljTypeNode",gljController.auth, gljController.init, gljController.createNewGljTypeNode);
    router.post("/updateGljNodes",gljController.auth, gljController.init, gljController.updateGljNodes);
    router.post("/deleteGljNodes",gljController.auth, gljController.init, gljController.deleteGljNodes);
    router.post("/updateNodes",gljController.auth, gljController.init, gljController.updateNodes);
    router.post("/getGljDistType",gljController.auth, gljController.init, gljController.getGljDistType);
    router.post("/getGljTree",gljController.auth, gljController.init, gljController.getGljTree);
    router.post("/getGljItems",gljController.auth, gljController.init, gljController.getGljItems);
    router.post("/updateComponent",gljController.auth, gljController.init, gljController.updateComponent);
    router.post("/batchUpdateComponent",gljController.auth, gljController.init, gljController.batchUpdateComponent);
    router.post("/mixUpdateGljItems",gljController.auth, gljController.init, gljController.mixUpdateGljItems);
    router.post("/getGljItemsByIds",gljController.auth, gljController.init, gljController.getGljItemsByIds);
    router.post("/getGljItemsByCodes",gljController.auth, gljController.init, gljController.getGljItemsByCodes);
    router.post("/getGljItemsOccupied",gljController.auth, gljController.init, gljController.getGljItemsOccupied);
    router.post("/isUsed",gljController.auth, gljController.init, gljController.isUsed);//工料机是否被引用
    router.post("/getReference",gljController.auth, gljController.init, gljController.getReference);
    router.post('/importPrice', gljController.auth, gljController.init, gljController.importPrice);
    router.post('/importComponents', gljController.auth, gljController.init, gljController.importComponents);


    app.use("/stdGljRepository/api", router);

};