"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const default_1 = require("../sdk/default");
const router = (0, express_1.Router)();
router.post("/zap/confirm/:sessionId", (req, res) => {
    const { sessionId } = req.params;
    const { message } = req.body;
    if (typeof message !== "string" || !message.trim()) {
        res.status(400).json({ error: "Missing or invalid 'message' in request body" });
        return;
    }
    const ok = default_1.defaultSdk.confirmZap(sessionId, message);
    if (ok) {
        res.json({ status: "ok", message: `Zap for session ${sessionId} resumed with message:${message}.` });
    }
    else {
        res.status(404).json({ error: `No zap pending for session ${sessionId}` });
    }
});
router.post("/zap/chain/:sessionId", (req, res) => {
    const { sessionId } = req.params;
    const { message } = req.body;
    if (typeof message !== "string" || !message.trim()) {
        res.status(400).json({ error: "Missing or invalid 'message' in request body" });
        return;
    }
    const ok = default_1.defaultSdk.confirmChainChange(sessionId, message);
    if (ok) {
        res.json({ status: "ok", message: `Zap for session ${sessionId} resumed with message:${message}.` });
    }
    else {
        res.status(404).json({ error: `No zap pending for session ${sessionId}` });
    }
});
exports.default = router;
