// ARI API Routes

import { Router } from 'express';
import { ariCortexService } from './ari-cortex.service';
import { ariReflexService } from './ari-reflex.service';
import { ariExecutionService } from './ari-execution.service';
import { ariDecisioningService } from './ari-decisioning.service';

const router = Router();

/**
 * @swagger
 * /api/v1/ari/policy/generate:
 *   post:
 *     summary: Generate regulatory policy
 */
router.post('/policy/generate', async (req, res, next) => {
  try {
    const result = await ariCortexService.generatePolicy(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/ari/predict:
 *   post:
 *     summary: Predict risk
 */
router.post('/predict', async (req, res, next) => {
  try {
    const result = await ariCortexService.predictRisk(req.body.sovereignBankId);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/ari/decision:
 *   post:
 *     summary: Make autonomous decision
 */
router.post('/decision', async (req, res, next) => {
  try {
    const result = await ariDecisioningService.makeDecision(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/ari/execute:
 *   post:
 *     summary: Execute decision
 */
router.post('/execute', async (req, res, next) => {
  try {
    const result = await ariExecutionService.executeDecision(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

export default router;

