const express = require('express');
const router = express.Router();
const IntelligenceService = require('../services/intelligence');
const Helpers = require('../helpers');

router.get('/', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getIntegratedAnalysis(organizationsId);
  res.status(200).send(result);
}));

router.get('/modeling', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getFinancialModeling(organizationsId);
  res.status(200).send(result);
}));

router.get('/opportunities', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getMarketOpportunities(organizationsId);
  res.status(200).send(result);
}));

router.get('/stewardship', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getFinancialStewardship(organizationsId);
  res.status(200).send(result);
}));

router.get('/risk', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getCashFlowRisk(organizationsId);
  res.status(200).send(result);
}));

router.get('/capital', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getCapitalStrategy(organizationsId);
  res.status(200).send(result);
}));

router.get('/leadership', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getStrategicLeadership(organizationsId);
  res.status(200).send(result);
}));

router.get('/esg', Helpers.wrapAsync(async (req, res) => {
  const organizationsId = req.currentUser.organizationsId;
  const result = await IntelligenceService.getESGStrategy(organizationsId);
  res.status(200).send(result);
}));

module.exports = router;