/**
 * Created by vian on 2017/3/17.
 */
let express = require("express");
let billsRouter =express.Router();
import ViewsPermContr from "../controllers/views_permissionController";
import BillsLibPermContr from "../controllers/stdBillsLib_permissionController";
import BillsPermContr from "../controllers/bills_permissionController";
import JobsPermContr from "../controllers/jobs_permissionController";
import ItemsPermContr from "../controllers/items_permissionController";
let viewsContr = new ViewsPermContr();
let billsLibContr = new BillsLibPermContr();
let billsContr = new BillsPermContr();
let jobsContr = new JobsPermContr();
let itemsContr = new ItemsPermContr();


module.exports =function (app) {
    app.get("/stdBillsmain", viewsContr.auth, viewsContr.init, viewsContr.redirectStdBillsMain);
    app.get("/stdBills", viewsContr.auth, viewsContr.init, viewsContr.redirectStdBills);
    app.get('/stdJobs', viewsContr.auth, viewsContr.init, viewsContr.redirectStdJobs);
    app.get('/stdItems', viewsContr.auth, viewsContr.init, viewsContr.redirectStdItems);

    billsRouter.post('/getCompilationList', billsLibContr.auth, billsLibContr.init, billsLibContr.getCompilationList);
    billsRouter.post('/getMaxNumber', billsLibContr.auth, billsLibContr.init, billsLibContr.getMaxNumber);
    billsRouter.post('/getABillsLib', billsLibContr.auth, billsLibContr.init, billsLibContr.getABillsLib);
    billsRouter.post("/getStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.getStdBillsLib);
    billsRouter.post("/createStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.createStdBillsLib);
    billsRouter.post("/copyStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.copyStdBillsLib);
    billsRouter.post("/deleteStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.deleteStdBillsLib);
    billsRouter.post("/renameStdBillsLib", billsLibContr.auth, billsLibContr.init, billsLibContr.renameStdBillsLib);
    billsRouter.post("/getStdBillsLibName", billsLibContr.auth, billsLibContr.init, billsLibContr.getStdBillsLibName);
    //导入清单
    billsRouter.post('/importBills', billsContr.importBills);
    //上传图片
    billsRouter.post('/uploadImg', billsContr.uploadImg);
    //删除图片
    billsRouter.post('/delImg', billsContr.delImg);
    //加载图片
    billsRouter.post('/loadImgs', billsContr.loadImgs);

    billsRouter.post("/upMove", billsContr.auth, billsContr.init, billsContr.upMove);
    billsRouter.post("/downMove", billsContr.auth, billsContr.init, billsContr.downMove);
    billsRouter.post("/getCurrentUniqId", billsContr.auth, billsContr.init, billsContr.getCurrentUniqId);
    billsRouter.post("/getBills", billsContr.auth, billsContr.init, billsContr.getBills);
    billsRouter.post("/createBills", billsContr.auth, billsContr.init, billsContr.createBills);
    billsRouter.post("/updatePNId", billsContr.auth, billsContr.init, billsContr.updatePNId);
    billsRouter.post("/upLevel", billsContr.auth, billsContr.init, billsContr.upLevel);
    billsRouter.post("/downLevel", billsContr.auth, billsContr.init, billsContr.downLevel);
    billsRouter.post("/updateBills", billsContr.auth, billsContr.init, billsContr.updateBills);
    billsRouter.post("/updateSectionInfo", billsContr.auth, billsContr.init, billsContr.updateSectionInfo);
    billsRouter.post("/updateBillsArr", billsContr.auth, billsContr.init, billsContr.updateBillsArr);
    billsRouter.post("/removeTotal", billsContr.auth, billsContr.init, billsContr.removeTotal);
    billsRouter.post("/updateSerialNo", billsContr.auth, billsContr.init, billsContr.updateSerialNo);
    billsRouter.post("/pasteBills", billsContr.auth, billsContr.init, billsContr.pasteBills);
    billsRouter.post('/updateRecharge', billsContr.auth, billsContr.init, billsContr.updateRecharge);
    billsRouter.post('/pasteRel', billsContr.auth, billsContr.init, billsContr.pasteRel);
    billsRouter.post("/deleteBills", billsContr.auth, billsContr.init, billsContr.deleteBills);
    billsRouter.post("/isUsed", billsContr.auth, billsContr.init, billsContr.isUsed);

    billsRouter.post("/getJobContent", jobsContr.auth, jobsContr.init, jobsContr.getJobContent);
    billsRouter.post("/createJobContent", jobsContr.auth, jobsContr.init, jobsContr.createJobContent);
    billsRouter.post("/updateJobContent", jobsContr.auth, jobsContr.init, jobsContr.updateJobContent);
    billsRouter.post("/deleteJobContent", jobsContr.auth, jobsContr.init, jobsContr.deleteJobContent);
    billsRouter.post("/pasteJobs", jobsContr.auth, jobsContr.init, jobsContr.pasteJobs);
    billsRouter.post("/edCreateJob", jobsContr.auth, jobsContr.init, jobsContr.edCreateJob);
    billsRouter.post("/edUpdateJob", jobsContr.auth, jobsContr.init, jobsContr.edUpdateJob);

    billsRouter.post("/getItemCharacter", itemsContr.auth, itemsContr.init, itemsContr.getItemCharacter);
    billsRouter.post("/createItemCharacter", itemsContr.auth, itemsContr.init, itemsContr.createItemCharacter);
    billsRouter.post("/updateItemCharacter", itemsContr.auth, itemsContr.init, itemsContr.updateItemCharacter);
    billsRouter.post("/updateValue", itemsContr.auth, itemsContr.init, itemsContr.updateValue);
    billsRouter.post("/deleteItemCharacter", itemsContr.auth, itemsContr.init, itemsContr.deleteItemCharacter);
    billsRouter.post("/pasteItems", itemsContr.auth, itemsContr.init, itemsContr.pasteItems);
    billsRouter.post("/pasteValues", itemsContr.auth, itemsContr.init, itemsContr.pasteValues);
    billsRouter.post("/edCreateItem", itemsContr.auth, itemsContr.init, itemsContr.edCreateItem);
    billsRouter.post("/edUpdateItem", itemsContr.auth, itemsContr.init, itemsContr.edUpdateItem);

    app.use("/stdBillsEditor", billsRouter);

};


