var express = require("express");
var payRoll = require("../json/payRoll.json");

exports = module.exports = function (IoC, policies, settings) {
  var app = this;
  var router = express.Router();
  var router2 = express.Router();
  var controller = IoC.create("controllers/auth");

  if (settings.prefix.length > 0) {
    // router.get("/index", controller.index);
    router.get("/signOut", controller.signOut);
  }

  router.get("/img/*", controller.getImg);

  router2.get("/", controller.indexPrefix);

  router.get("/productDes", controller.productDes);

  router.get("/register", controller.register);

  router.get("/mobileRegister", controller.mobileRegister);

  router.get("/mobileRegisterSuccess", controller.mobileRegisterSuccess);

  router.get("/signIn", controller.signIn);

  router.post("/doLogin", controller.doLogin);

  router2.get("/signOut", controller.signOut);

  router.post("/smsCodes", controller.smsCodes);

  router.post("/tenants", controller.tenants);

  router.post("/resetPass", policies.ensureLoggedOut(), controller.resetPass);

  router.post(
    "/updatePassword",
    policies.ensureLoggedOut(),
    controller.updatePassword
  );

  router.post(
    "/loadUserInfo",
    policies.ensureLoggedOut(),
    controller.loadUserInfo
  );

  router.post(
    "/getUploaderToken",
    policies.ensureLoggedOut(),
    controller.getUploaderToken
  );

  router.post(
    "/delOSSObject",
    policies.ensureLoggedOut(),
    controller.delOSSObject
  );

  router.post("/smsVerification", controller.smsVerification);

  router.post("/getObjectTokenByID", controller.getObjectTokenByID);

  // router.get(
  // 	'/healthMonitor',
  // 	controller.healthMonitor
  // )

  // router.head(
  // 	'/healthMonitor',
  // 	controller.healthMonitor
  // )

  router.post(
    "/getUserRoles",
    policies.ensureLoggedOut(),
    controller.getUserRoles
  );

  router.post("/getRoles", policies.ensureLoggedOut(), controller.getRoles);

  router.post(
    "/updateUserRoles",
    policies.ensureLoggedOut(),
    controller.updateUserRoles
  );

  router.post("/getTenant", policies.ensureLoggedOut(), controller.getTenant);

  router.post(
    "/updateTenant",
    policies.ensureLoggedOut(),
    controller.updateTenant
  );

  router.get("/offer/:requestId", controller.offer);

  router.post(
    "/onboardStatus",
    policies.ensureLoggedOut(),
    controller.onboardStatus
  );

  router.get("/downloadApp", controller.dowloadApp);

  router.get("/info/policy", controller.softwareLicense);

  router.get("/payRoll", function (req, res, next) {
    res.send(payRoll);
  });

  router.get("/recharge", controller.recharge);

  router.post("/changePassForRegister", controller.changePassForRegister);

  router.post(
    "/changeTenant",
    policies.ensureLoggedOut(),
    controller.changeTenant
  );

  router.post("/hr/sendRejectOffer", controller.sendRejectOffer);

  router.post("/hr/acceptOffer", controller.acceptOffer);

  router.post("/imTokens", policies.ensureLoggedOut(), controller.imTokens);

  router.post(
    "/listChannels",
    policies.ensureLoggedOut(),
    controller.listChannels
  );

  router.post(
    "/getTastLink",
    policies.ensureLoggedOut(),
    controller.getTastLink
  );

  router.get("/filemeta", policies.ensureLoggedOut(), controller.filemeta);

  router.get(
    "/getCustomerQrcode",
    policies.ensureLoggedOut(),
    controller.getCustomerQrcode
  );

  router.get(
    "/getPositionQrcode",
    policies.ensureLoggedOut(),
    controller.getPositionQrcode
  );
  router.get(
    //微店模板路由
    "/minishop/:id",
    controller.weidianTempLate
  );

  router.get("/wso-workai", controller.workaiSecurityOAuth);

  router.get(
    "/socialwork/freedom-jobs/emps/:id/:verification",
    controller.freedomJobsEmp
  );

  router.get("/socialwork/freedom-jobs/emps/:id", controller.freedomJobsEmp);

  router.get("/getShortToken", controller.getShortToken);

  router.get("/gainianrenli/*",controller.getImg)
  router.get("/waifu_img/*",controller.getImg)
  router.get("/my_img/*",controller.getImg)
  router.get("/invoice_file_icon/*",controller.getImg)
  router.get("/gainianrenli/*",controller.getImg)
  router.get("/claim_icons/*",controller.getImg)

  app.use("/", router);

  app.use("/index", router2);
};

exports["@require"] = ["$container", "policies", "igloo/settings"];
exports["@singleton"] = true;