/**
 * Created by Tony on 2017/6/15.
 */
let express = require("express");

module.exports = function (app) {
    let apiRouter =express.Router();
//var _rootDir = __dirname;

    var rationRepositoryController = require("../controllers/ration_repository_controller");
    var rationChapterTreeController = require("../controllers/ration_section_tree_controller");
    var rationController = require("../controllers/ration_controller");
    var repositoryGljController = require("../controllers/repository_glj_controller");
    var coeListController = require("../controllers/coe_controller");
    var searchController = require('../controllers/search_controller');

    apiRouter.post("/getRationDisplayNames",rationRepositoryController.getDisPlayRationLibs);
    apiRouter.post("/getRealLibName",rationRepositoryController.getRealLibName);
    apiRouter.post("/getLibIDByName",rationRepositoryController.getLibIDByName);

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

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

    apiRouter.post("/getGljTree",repositoryGljController.getGljTree);
    apiRouter.post("/getGljItems",repositoryGljController.getGljItems);
    apiRouter.post("/getGljItemsByIds",repositoryGljController.getGljItemsByIds);
    apiRouter.post("/getGljItemsByCodes",repositoryGljController.getGljItemsByCodes);

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

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

    app.use("/rationRepository/api", apiRouter);
};



