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

exports = module.exports = function (IoC, policies) {
	var app = this;
	var router = express.Router();
	var controller = IoC.create('controllers/auth');
	router.get(
		'/',
		controller.index
	);
	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
	);

	router.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.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
	);

	app.use('/', router);
};

exports['@require'] = ['$container', 'policies'];
exports['@singleton'] = true;