import { Router } from "express";

import { financialStatementsController } from "../controllers/financialStatementsController.js";

const router = Router();
const asyncHandler = (handler) => (req, res, next) =>
  Promise.resolve(handler(req, res, next)).catch(next);

router.get("/", asyncHandler(financialStatementsController.list));
router.get("/mapping", asyncHandler(financialStatementsController.getMapping));
router.put("/mapping", asyncHandler(financialStatementsController.updateMapping));
router.get("/bilan", asyncHandler(financialStatementsController.getBilan));
router.get(
  "/income-statement",
  asyncHandler(financialStatementsController.getIncomeStatement),
);
router.get("/cash-flow", asyncHandler(financialStatementsController.getCashFlow));
router.get(
  "/equity-changes",
  asyncHandler(financialStatementsController.getEquityChanges),
);
router.get("/notes", asyncHandler(financialStatementsController.getNotes));
router.put("/notes", asyncHandler(financialStatementsController.updateNotes));
router.get("/export", asyncHandler(financialStatementsController.exportStatements));

export default router;
