/**
 * router of sub app 3party
 * @author: htoooth<ht.anglenx@gmail.com>
 * @date: 2016/11/08
 */

'use strict';

const router = require('express').Router();  // eslint-disable-line
const cRoot = './controllers';

const auth = require(`${global.middleware}/auth`);
const captcha = require('../passport/controllers/captcha');

const ads = require(`${cRoot}/ads`); // 第三方广告平台对接
const robot = require(`${cRoot}/robot-check`); // 机器人检查
const materialController = require(`${cRoot}/material`);
const activate = require(`${cRoot}/activate`); // 激活点击统计
const questionnaire = require(`${cRoot}/questionnaire`);

router.get('/ads', ads.jump);
router.get('/check', captcha.requiredWithRisk, robot.index);
router.post('/check', robot.check, robot.isHuman);
router.get('/captcha.png', robot.img);

router.get('/material', auth, materialController.indexNew);
router.get('/material/old', auth, materialController.index);
router.get('/material/newBrandList', auth, materialController.newBrandList);
router.get('/material/getCategory', auth, materialController.getCategory);
router.get('/material/getList', auth, materialController.getList);
router.get('/material/getRecommendlist', auth, materialController.getRecommendlist);

router.get('/activate-count', auth, activate.index);
router.get('/activate-count/getList', auth, activate.getList);
router.get('/questionnaire/:id', questionnaire.getQuestionnaire);
router.get('/questionnaire', auth, questionnaire.getQuestionList);
module.exports = router;