import SessionService from "../application/PrintService";
import ActionInteraction from "../domain/ActionInteraction";
import CommentInteraction from "../domain/CommentInteraction";

const ERROR_STATUS: number = 500;
const SUCCESS_STATUS: number = 200;

export default function attachRoutes(app, sessionService: SessionService): void {

    app.get("/printer/ping", (req, res) => {
        res.send('alive');
    });

    app.get("/printer/print/:sessionId", (req, res) => {
        const {sessionId} = req.params;
        sessionService.printSession(sessionId)
        .then((print) => {
            res.send(print);
        })
        .catch( (e) => {
            console.log(e);
            res.status(ERROR_STATUS).send("error");
        });
    });


}
