"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "getScopedPrinter", {
    enumerable: true,
    get: function() {
        return getScopedPrinter;
    }
});
const _printer = require("./printer");
const _runtimeexceptions = require("../exceptions/runtime.exceptions");
function getScopedPrinter(req) {
    const errors = [];
    const resolve = (token)=>{
        try {
            const dep = req.container.resolve(token);
            if (!dep) errors.push(`Scoped Dependency '${token}' was not resolved.`);
            return dep;
        } catch  {
            throw new _runtimeexceptions.InternalServerException(`Dependency ${token} could not be resolved. Aborted request.`);
        }
    };
    const printerApi = resolve(_printer.printerApiToken);
    const loginDto = resolve(_printer.printerLoginToken);
    const printerDto = resolve(_printer.currentPrinterToken);
    const printerId = resolve(_printer.printerIdToken);
    if (errors.length) throw new _runtimeexceptions.ValidationException(errors);
    return {
        [_printer.printerApiToken]: printerApi,
        [_printer.printerLoginToken]: loginDto,
        [_printer.currentPrinterToken]: printerDto,
        [_printer.printerIdToken]: printerId
    };
}

//# sourceMappingURL=printer-resolver.js.map