// DSCN API Routes

import { Router } from 'express';
import { dscnNodeManagerService } from './dscn-node-manager.service';
import { dscnAmlScannerService } from './dscn-aml-scanner.service';
import { dscnSanctionsCheckerService } from './dscn-sanctions-checker.service';
import { dscnIdentityVerifierService } from './dscn-identity-verifier.service';
import { dscnSyncService } from './dscn-sync.service';

const router = Router();

/**
 * @swagger
 * /api/v1/dscn/node/register:
 *   post:
 *     summary: Register DSCN node
 */
router.post('/node/register', async (req, res, next) => {
  try {
    const result = await dscnNodeManagerService.registerNode(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/dscn/aml/scan:
 *   post:
 *     summary: Perform AML scan
 */
router.post('/aml/scan', async (req, res, next) => {
  try {
    const result = await dscnAmlScannerService.performAmlScan(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/dscn/sanctions/check:
 *   post:
 *     summary: Perform sanctions check
 */
router.post('/sanctions/check', async (req, res, next) => {
  try {
    const result = await dscnSanctionsCheckerService.performSanctionsCheck(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/dscn/identity/verify:
 *   post:
 *     summary: Perform identity verification
 */
router.post('/identity/verify', async (req, res, next) => {
  try {
    const result = await dscnIdentityVerifierService.performIdentityVerification(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

/**
 * @swagger
 * /api/v1/dscn/sync:
 *   post:
 *     summary: Sync with DBIS
 */
router.post('/sync', async (req, res, next) => {
  try {
    const result = await dscnSyncService.syncToDbis(req.body);
    res.json(result);
  } catch (error) {
      return next(error);
  }
});

export default router;

