/**
 * Development-only routes. Not mounted in production.
 */
import { Router, type Request, type Response } from "express";
import { lnbitsService } from "../lib/lnbits.js";

const router = Router();

/**
 * POST /dev/stub/pay/:paymentHash
 * Marks a stub invoice as paid in the in-memory store.
 * Only available when LNbitsService is in stub mode (i.e. no real LNbits creds).
 */
router.post("/dev/stub/pay/:paymentHash", (req: Request, res: Response) => {
  const { paymentHash } = req.params as { paymentHash: string };
  if (!lnbitsService.stubMode) {
    res.status(400).json({ error: "Stub mode is not active. Real LNbits credentials are configured." });
    return;
  }
  lnbitsService.stubMarkPaid(paymentHash);
  res.json({ ok: true, paymentHash });
});

export default router;
