// CBDC Governance API Routes

import { Router } from 'express';
import { cbdcSupplyControlService } from './cbdc-supply-control.service';
import { cbdcVelocityControlService } from './cbdc-velocity-control.service';
import { cbdcLiquidityManagementService } from './cbdc-liquidity-management.service';
import { cbdcMonetarySimulationService } from './cbdc-monetary-simulation.service';

const router = Router();

router.post('/supply-control', async (req, res, next) => {
  try {
    const control = await cbdcSupplyControlService.createSupplyControl(req.body);
    res.status(201).json(control);
  } catch (error) {
      return next(error);
  }
});

router.post('/velocity-control', async (req, res, next) => {
  try {
    const control = await cbdcVelocityControlService.createVelocityControl(req.body);
    res.status(201).json(control);
  } catch (error) {
      return next(error);
  }
});

router.post('/liquidity-window', async (req, res, next) => {
  try {
    const window = await cbdcLiquidityManagementService.createLiquidityWindow(req.body);
    res.status(201).json(window);
  } catch (error) {
      return next(error);
  }
});

router.post('/simulation', async (req, res, next) => {
  try {
    const simulation = await cbdcMonetarySimulationService.runSimulation(req.body);
    res.json(simulation);
  } catch (error) {
      return next(error);
  }
});

export default router;

