"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    PrintCompletionController: function() {
        return PrintCompletionController;
    },
    default: function() {
        return _default;
    }
});
const _authenticate = require("../middleware/authenticate");
const _awilixexpress = require("awilix-express");
const _serverconstants = require("../server.constants");
const _authorizationconstants = require("../constants/authorization.constants");
const _validators = require("../handlers/validators");
class PrintCompletionController {
    printCompletionService;
    printCompletionSocketIoTask;
    constructor({ printCompletionService, printCompletionSocketIoTask }){
        this.printCompletionService = printCompletionService;
        this.printCompletionSocketIoTask = printCompletionSocketIoTask;
    }
    async test(req, res) {
        const result = await this.printCompletionService.loadPrintContexts();
        res.send(result);
    }
    contexts(req, res) {
        const contexts = this.printCompletionSocketIoTask.contexts;
        res.send(contexts);
    }
    async findCorrelatedEntries(req, res) {
        const { correlationId } = await (0, _validators.validateInput)(req.params, {
            correlationId: "required|string"
        });
        const result = await this.printCompletionService.findPrintCompletion(correlationId);
        res.send(result);
    }
    async list(req, res) {
        const completions = await this.printCompletionService.listGroupByPrinterStatus();
        res.send(completions);
    }
}
const _default = (0, _awilixexpress.createController)(PrintCompletionController).prefix(_serverconstants.AppConstants.apiRoute + "/print-completion").before([
    (0, _authenticate.authenticate)()
]).get("/", "list", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrintCompletion.List)).get("/test", "test", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrintCompletion.List)).get("/contexts", "contexts", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrintCompletion.List)).get("/:correlationId", "findCorrelatedEntries", (0, _authenticate.withPermission)(_authorizationconstants.PERMS.PrintCompletion.Default));

//# sourceMappingURL=print-completion.controller.js.map