/**
 * Created by Tony on 2017/4/20.
 */
let express = require("express");
let apiRouter =express.Router();
//var _rootDir = __dirname;
module.exports = function (app) {
    let rationRepositoryController = require("../controllers/ration_repository_controller");
    let rationChapterTreeController = require("../controllers/ration_section_tree_controller");
    let rationController = require("../controllers/ration_controller");
    let repositoryGljController = require("../controllers/repository_glj_controller");
    let coeListController = require("../controllers/coe_controller");
    let searchController = require('../controllers/search_controller');

    apiRouter.post("/getRationDisplayNames",rationRepositoryController.getDisPlayRationLibs);
    apiRouter.post("/editRationLibs",rationRepositoryController.updateRationRepositoryName);
    apiRouter.post("/addRationRepository",rationRepositoryController.addRationRepository);
    apiRouter.post("/deleteRationLibs",rationRepositoryController.deleteRationLib);
    apiRouter.post("/getRealLibName",rationRepositoryController.getRealLibName);
    apiRouter.post("/getLibIDByName",rationRepositoryController.getLibIDByName);

    apiRouter.post("/getRationTree",rationChapterTreeController.getRationChapterTree);
    apiRouter.post("/createNewNode",rationChapterTreeController.createNewNode);
    apiRouter.post("/updateNodes",rationChapterTreeController.updateNodes);
    apiRouter.post("/deleteNodes",rationChapterTreeController.deleteNodes);

    apiRouter.post("/getRationItems",rationController.getRationItemsBySection);
    apiRouter.post("/mixUpdateRationItems",rationController.mixUpdateRationItems);

    apiRouter.post("/createNewGljTypeNode",repositoryGljController.createNewGljTypeNode);
    apiRouter.post("/updateGljNodes",repositoryGljController.updateGljNodes);
    apiRouter.post("/deleteGljNodes",repositoryGljController.deleteGljNodes);
    apiRouter.post("/getGljTree",repositoryGljController.getGljTree);
    apiRouter.post("/getGljItems",repositoryGljController.getGljItems);
    apiRouter.post("/mixUpdateGljItems",repositoryGljController.mixUpdateGljItems);
    apiRouter.post("/getGljItemsByIds",repositoryGljController.getGljItemsByIds);
    apiRouter.post("/getGljItemsByCodes",repositoryGljController.getGljItemsByCodes);

    apiRouter.post("/getCoeList",coeListController.getCoeList);
    apiRouter.post("/saveCoeList",coeListController.saveCoeList);
    apiRouter.post("/getCoeItemsByIDs",coeListController.getCoeItemsByIDs);

    apiRouter.post('/getRationItem', searchController.getRationItem);
    apiRouter.post('/findRation', searchController.findRation);
    apiRouter.post('/matchRation', searchController.matchRation);
};


