"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "PrintJobController", {
    enumerable: true,
    get: function() {
        return PrintJobController;
    }
});
const _awilixexpress = require("awilix-express");
const _serverconstants = require("../server.constants");
const _express = require("express");
const _authenticate = require("../middleware/authenticate");
const _authorizationconstants = require("../constants/authorization.constants");
const _printjobvalidation = require("../services/validators/print-job.validation");
const _validators = require("../handlers/validators");
const _printjobservice = require("../services/orm/print-job.service");
const _fileanalysisservice = require("../services/file-analysis.service");
const _filestorageservice = require("../services/file-storage.service");
const _loggerfactory = require("../handlers/logger-factory");
const _paramconvertermiddleware = require("../middleware/param-converter.middleware");
const _runtimeexceptions = require("../exceptions/runtime.exceptions");
function _ts_decorate(decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function _ts_metadata(k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}
class PrintJobController {
    printJobService;
    fileAnalysisService;
    fileStorageService;
    logger;
    constructor(loggerFactory, printJobService, fileAnalysisService, fileStorageService){
        this.printJobService = printJobService;
        this.fileAnalysisService = fileAnalysisService;
        this.fileStorageService = fileStorageService;
        this.logger = loggerFactory(PrintJobController.name);
    }
    async searchJobs(req, res) {
        const { searchPrinter, searchFile, startDate, endDate } = await (0, _validators.validateInput)(req.query, _printjobvalidation.searchJobsSchema);
        const endDateObj = endDate ? this.toEndOfDay(new Date(endDate)) : undefined;
        const result = await this.printJobService.searchPrintJobs(searchPrinter, searchFile, startDate ? new Date(startDate) : undefined, endDateObj);
        res.send(result);
    }
    async searchJobsPaged(req, res) {
        const { page, pageSize, searchPrinter, searchFile, startDate, endDate } = await (0, _validators.validateInput)(req.query, _printjobvalidation.searchJobsPagedSchema);
        const endDateObj = endDate ? this.toEndOfDay(new Date(endDate)) : undefined;
        const [items, count] = await this.printJobService.searchPrintJobsPaged(searchPrinter, searchFile, startDate ? new Date(startDate) : undefined, endDateObj, page, pageSize);
        res.send({
            items,
            count,
            pages: Math.ceil(count / pageSize)
        });
    }
    async getJob(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId, [
            'printer'
        ]);
        try {
            let thumbnailCount = 0;
            if (job.fileStorageId) {
                const thumbnails = await this.fileStorageService.listThumbnails(job.fileStorageId);
                thumbnailCount = thumbnails.length;
            }
            res.send({
                ...job,
                thumbnailCount,
                thumbnailsUrl: thumbnailCount > 0 ? `/api/print-jobs/${jobId}/thumbnails` : null
            });
        } catch (error) {
            this.logger.error(`Failed to get job ${jobId}: ${error}`);
            res.status(500).send({
                error: "Failed to get job"
            });
        }
    }
    async setCompleted(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        try {
            if (job.status !== "UNKNOWN") {
                res.status(400).send({
                    error: "Can only mark UNKNOWN jobs as completed",
                    currentStatus: job.status,
                    suggestion: "This endpoint is for resolving jobs with unknown state"
                });
                return;
            }
            this.logger.log(`Manually marking job ${jobId} as COMPLETED (was UNKNOWN)`);
            job.status = "COMPLETED";
            job.endedAt = new Date();
            job.progress = 100;
            job.statusReason = "Manually marked as completed by user";
            if (job.statistics) {
                job.statistics.endedAt = job.endedAt;
                job.statistics.progress = 100;
            } else {
                job.statistics = {
                    startedAt: job.startedAt,
                    endedAt: job.endedAt,
                    actualPrintTimeSeconds: null,
                    progress: 100
                };
            }
            await this.printJobService.printJobRepository.save(job);
            this.logger.log(`Job ${jobId} marked as COMPLETED`);
            res.send({
                message: "Job marked as completed",
                jobId,
                previousStatus: "UNKNOWN",
                newStatus: "COMPLETED"
            });
        } catch (error) {
            this.logger.error(`Failed to mark job ${jobId} as completed: ${error}`);
            res.status(500).send({
                error: "Failed to update job status",
                message: error instanceof Error ? error.message : "Unknown error"
            });
        }
    }
    async setFailed(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        const previousStatus = job.status;
        if (![
            "UNKNOWN",
            "PRINTING",
            "CANCELLED",
            "COMPLETED"
        ].includes(job.status)) {
            res.status(400).send({
                error: "Can only mark UNKNOWN, PRINTING, CANCELLED, or COMPLETED jobs as failed",
                currentStatus: job.status
            });
            return;
        }
        try {
            this.logger.log(`Manually marking job ${jobId} as FAILED (was ${previousStatus})`);
            const endedAt = new Date();
            const actualTimeSeconds = job.startedAt ? (endedAt.getTime() - job.startedAt.getTime()) / 1000 : null;
            job.status = "FAILED";
            job.endedAt = endedAt;
            job.statusReason = "Manually marked as failed by user";
            if (!job.statistics) {
                job.statistics = {
                    startedAt: job.startedAt,
                    endedAt,
                    actualPrintTimeSeconds: actualTimeSeconds,
                    progress: job.progress,
                    failureReason: "Manually marked as failed by user",
                    failureTime: endedAt
                };
            } else {
                job.statistics.endedAt = endedAt;
                job.statistics.actualPrintTimeSeconds = actualTimeSeconds;
                job.statistics.failureReason = "Manually marked as failed by user";
                job.statistics.failureTime = endedAt;
            }
            await this.printJobService.printJobRepository.save(job);
            this.logger.log(`Job ${jobId} marked as FAILED`);
            res.send({
                message: "Job marked as failed",
                jobId,
                previousStatus,
                newStatus: "FAILED"
            });
        } catch (error) {
            this.logger.error(`Failed to mark job ${jobId} as failed: ${error}`);
            res.status(500).send({
                error: "Failed to update job status",
                message: error instanceof Error ? error.message : "Unknown error"
            });
        }
    }
    async setCancelled(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        const previousStatus = job.status;
        if (![
            "UNKNOWN",
            "PRINTING",
            "PAUSED"
        ].includes(job.status)) {
            res.status(400).send({
                error: "Can only mark UNKNOWN, PRINTING, or PAUSED jobs as cancelled",
                currentStatus: job.status
            });
            return;
        }
        try {
            this.logger.log(`Manually marking job ${jobId} as CANCELLED (was ${previousStatus})`);
            const endedAt = new Date();
            const actualTimeSeconds = job.startedAt ? (endedAt.getTime() - job.startedAt.getTime()) / 1000 : null;
            job.status = "CANCELLED";
            job.endedAt = endedAt;
            job.statusReason = "Manually marked as cancelled by user";
            if (!job.statistics) {
                job.statistics = {
                    startedAt: job.startedAt,
                    endedAt,
                    actualPrintTimeSeconds: actualTimeSeconds,
                    progress: job.progress
                };
            } else {
                job.statistics.endedAt = endedAt;
                job.statistics.actualPrintTimeSeconds = actualTimeSeconds;
            }
            await this.printJobService.printJobRepository.save(job);
            this.logger.log(`Job ${jobId} marked as CANCELLED`);
            res.send({
                message: "Job marked as cancelled",
                jobId,
                previousStatus,
                newStatus: "CANCELLED"
            });
        } catch (error) {
            this.logger.error(`Failed to mark job ${jobId} as cancelled: ${error}`);
            res.status(500).send({
                error: "Failed to update job status",
                message: error instanceof Error ? error.message : "Unknown error"
            });
        }
    }
    async setUnknown(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        const previousStatus = job.status;
        if (![
            "PRINTING",
            "PAUSED"
        ].includes(job.status)) {
            res.status(400).send({
                error: "Can only mark PRINTING or PAUSED jobs as unknown",
                currentStatus: job.status,
                suggestion: "This endpoint is for marking jobs with uncertain state (e.g., after connection loss)"
            });
            return;
        }
        try {
            this.logger.log(`Manually marking job ${jobId} as UNKNOWN (was ${previousStatus})`);
            job.status = "UNKNOWN";
            job.statusReason = "Manually marked as unknown by user (state uncertain)";
            await this.printJobService.printJobRepository.save(job);
            this.logger.log(`Job ${jobId} marked as UNKNOWN`);
            res.send({
                message: "Job marked as unknown",
                jobId,
                previousStatus,
                newStatus: "UNKNOWN"
            });
        } catch (error) {
            this.logger.error(`Failed to mark job ${jobId} as unknown: ${error}`);
            res.status(500).send({
                error: "Failed to update job status",
                message: error instanceof Error ? error.message : "Unknown error"
            });
        }
    }
    async reAnalyzeJob(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        this.logger.log(`Re-analyzing job ${jobId}`);
        try {
            if (!job.fileStorageId) {
                this.logger.log(`Job ${jobId} has no fileStorageId - triggering download and analysis`);
                await this.printJobService.triggerFileAnalysis(jobId);
                res.send({
                    message: "File download and analysis triggered (async)",
                    jobId,
                    status: "pending"
                });
                return;
            }
            const filePath = this.fileStorageService.getFilePath(job.fileStorageId);
            const exists = await this.fileAnalysisService.needsAnalysis(filePath);
            if (!exists) {
                throw new _runtimeexceptions.NotFoundException(`File not found in storage: ${job.fileStorageId}`);
            }
            this.logger.log(`Re-analyzing file for job ${jobId}: ${filePath}`);
            job.analysisState = "ANALYZING";
            await this.printJobService.printJobRepository.save(job);
            const { metadata, thumbnails } = await this.fileAnalysisService.analyzeFile(filePath);
            let thumbnailMetadata = [];
            if (thumbnails && thumbnails.length > 0) {
                thumbnailMetadata = await this.fileStorageService.saveThumbnails(job.fileStorageId, thumbnails);
                this.logger.log(`Saved ${thumbnailMetadata.length} thumbnail(s) for job ${jobId}`);
            }
            await this.printJobService.handleFileAnalyzed(jobId, metadata, thumbnails);
            const fileHash = job.fileHash || undefined;
            await this.fileStorageService.saveMetadata(job.fileStorageId, metadata, fileHash, job.fileName, thumbnailMetadata);
            this.logger.log(`Successfully re-analyzed job ${jobId}`);
            res.send({
                message: "File re-analyzed successfully",
                jobId,
                status: "analyzed",
                metadata,
                thumbnailCount: thumbnails?.length || 0
            });
        } catch (error) {
            this.logger.error(`Failed to re-analyze job ${jobId}: ${error}`);
            res.status(500).send({
                error: "Re-analysis failed",
                message: error instanceof Error ? error.message : "Unknown error"
            });
        }
    }
    async deleteJob(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        const deleteFileParam = req.query.deleteFile === 'true';
        if (job.status === "PRINTING" || job.status === "PAUSED") {
            res.status(400).send({
                error: "Cannot delete active print job",
                status: job.status,
                suggestion: "Wait for print to complete or cancel it first"
            });
            return;
        }
        try {
            const fileStorageId = job.fileStorageId;
            const fileName = job.fileName;
            await this.printJobService.printJobRepository.remove(job);
            this.logger.log(`Deleted job ${jobId}: ${fileName}`);
            if (fileStorageId && deleteFileParam) {
                const otherJobs = await this.printJobService.printJobRepository.count({
                    where: {
                        fileStorageId
                    }
                });
                if (otherJobs === 0) {
                    try {
                        await this.fileStorageService.deleteFile(fileStorageId);
                        this.logger.log(`Deleted file as requested: ${fileStorageId}`);
                        res.send({
                            message: "Job and associated file deleted",
                            jobId,
                            fileDeleted: true
                        });
                    } catch (error) {
                        this.logger.warn(`Failed to delete file ${fileStorageId}: ${error}`);
                        res.send({
                            message: "Job deleted, but file deletion failed",
                            jobId,
                            fileDeleted: false
                        });
                    }
                } else {
                    this.logger.log(`File ${fileStorageId} still referenced by ${otherJobs} other job(s) - keeping file`);
                    res.send({
                        message: "Job deleted (file kept - still used by other jobs)",
                        jobId,
                        fileDeleted: false,
                        remainingReferences: otherJobs
                    });
                }
            } else {
                res.send({
                    message: "Job deleted",
                    jobId,
                    fileDeleted: false
                });
            }
        } catch (error) {
            this.logger.error(`Failed to delete job ${jobId}: ${error}`);
            res.status(500).send({
                error: "Delete failed",
                message: error instanceof Error ? error.message : "Unknown error"
            });
        }
    }
    async getThumbnails(req, res) {
        const jobId = req.local.id;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        if (!job.fileStorageId) {
            res.send({
                jobId,
                thumbnails: []
            });
            return;
        }
        try {
            const metadata = await this.fileStorageService.loadMetadata(job.fileStorageId);
            const thumbnailMetadata = metadata?._thumbnails || [];
            res.send({
                jobId,
                fileStorageId: job.fileStorageId,
                thumbnails: thumbnailMetadata.map((thumb)=>({
                        index: thumb.index,
                        url: `/api/print-jobs/${jobId}/thumbnails/${thumb.index}`,
                        filename: thumb.filename,
                        width: thumb.width,
                        height: thumb.height,
                        format: thumb.format,
                        size: thumb.size
                    }))
            });
        } catch (error) {
            this.logger.error(`Failed to get thumbnails for job ${jobId}: ${error}`);
            res.status(500).send({
                error: "Failed to get thumbnails"
            });
        }
    }
    async getThumbnail(req, res) {
        const jobId = req.local.id;
        const index = req.local.index;
        const job = await this.printJobService.getJobByIdOrFail(jobId);
        if (!job.fileStorageId) {
            throw new _runtimeexceptions.NotFoundException("Job has no stored file");
        }
        try {
            const thumbnail = await this.fileStorageService.getThumbnail(job.fileStorageId, index);
            if (!thumbnail) {
                throw new _runtimeexceptions.NotFoundException(`Thumbnail ${index} not found`);
            }
            const isPNG = thumbnail[0] === 0x89 && thumbnail[1] === 0x50 && thumbnail[2] === 0x4E && thumbnail[3] === 0x47;
            const isJPG = thumbnail[0] === 0xFF && thumbnail[1] === 0xD8;
            const isQOI = thumbnail[0] === 0x71 && thumbnail[1] === 0x6F && thumbnail[2] === 0x69 && thumbnail[3] === 0x66;
            let contentType = 'image/png';
            if (isPNG) contentType = 'image/png';
            else if (isJPG) contentType = 'image/jpeg';
            else if (isQOI) contentType = 'image/qoi';
            res.setHeader('Content-Type', contentType);
            res.setHeader('Cache-Control', 'public, max-age=3600');
            res.setHeader('ETag', `"${job.fileStorageId}-${index}"`);
            res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
            res.send(thumbnail);
        } catch (error) {
            this.logger.error(`Failed to get thumbnail ${index} for job ${jobId}: ${error}`);
            res.status(500).send({
                error: "Failed to get thumbnail"
            });
        }
    }
    async createJobFromFile(req, res) {
        const { fileStorageId, printerId } = req.body;
        if (!fileStorageId) {
            res.status(400).send({
                error: "fileStorageId is required"
            });
            return;
        }
        if (!printerId) {
            res.status(400).send({
                error: "printerId is required"
            });
            return;
        }
        try {
            const fileExists = await this.fileStorageService.fileExists(fileStorageId);
            if (!fileExists) {
                throw new _runtimeexceptions.NotFoundException("File not found in storage");
            }
            const metadata = await this.fileStorageService.loadMetadata(fileStorageId);
            if (!metadata) {
                res.status(400).send({
                    error: "File has no metadata. Please analyze the file first."
                });
                return;
            }
            const printerName = `Printer ${printerId}`;
            const job = await this.printJobService.createPendingJob(printerId, metadata._originalFileName || metadata.fileName || "Unknown", metadata, printerName);
            job.fileStorageId = fileStorageId;
            job.fileHash = metadata._fileHash;
            job.analysisState = "ANALYZED";
            job.analyzedAt = new Date();
            if (metadata.fileFormat) {
                job.fileFormat = metadata.fileFormat;
            }
            await this.printJobService.printJobRepository.save(job);
            this.logger.log(`Created job ${job.id} from file storage ${fileStorageId} for printer ${printerId}`);
            res.send({
                id: job.id,
                printerId: job.printerId,
                printerName: job.printerName,
                fileName: job.fileName,
                fileStorageId: job.fileStorageId,
                status: job.status,
                analysisState: job.analysisState,
                createdAt: job.createdAt
            });
        } catch (error) {
            this.logger.error(`Failed to create job from file ${fileStorageId}: ${error}`);
            res.status(500).send({
                error: "Failed to create job from file"
            });
        }
    }
    toEndOfDay(date) {
        const endOfDay = new Date(date);
        endOfDay.setHours(23, 59, 59, 999);
        return endOfDay;
    }
}
_ts_decorate([
    (0, _awilixexpress.GET)(),
    (0, _awilixexpress.route)("/search"),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "searchJobs", null);
_ts_decorate([
    (0, _awilixexpress.GET)(),
    (0, _awilixexpress.route)("/search-paged"),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "searchJobsPaged", null);
_ts_decorate([
    (0, _awilixexpress.GET)(),
    (0, _awilixexpress.route)("/:id"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "getJob", null);
_ts_decorate([
    (0, _awilixexpress.POST)(),
    (0, _awilixexpress.route)("/:id/set-completed"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "setCompleted", null);
_ts_decorate([
    (0, _awilixexpress.POST)(),
    (0, _awilixexpress.route)("/:id/set-failed"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "setFailed", null);
_ts_decorate([
    (0, _awilixexpress.POST)(),
    (0, _awilixexpress.route)("/:id/set-cancelled"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "setCancelled", null);
_ts_decorate([
    (0, _awilixexpress.POST)(),
    (0, _awilixexpress.route)("/:id/set-unknown"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "setUnknown", null);
_ts_decorate([
    (0, _awilixexpress.POST)(),
    (0, _awilixexpress.route)("/:id/re-analyze"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "reAnalyzeJob", null);
_ts_decorate([
    (0, _awilixexpress.DELETE)(),
    (0, _awilixexpress.route)("/:id"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "deleteJob", null);
_ts_decorate([
    (0, _awilixexpress.GET)(),
    (0, _awilixexpress.route)("/:id/thumbnails"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "getThumbnails", null);
_ts_decorate([
    (0, _awilixexpress.GET)(),
    (0, _awilixexpress.route)("/:id/thumbnails/:index"),
    (0, _awilixexpress.before)([
        (0, _paramconvertermiddleware.ParamId)("id"),
        (0, _paramconvertermiddleware.ParamInt)("index")
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "getThumbnail", null);
_ts_decorate([
    (0, _awilixexpress.POST)(),
    (0, _awilixexpress.route)("/from-file"),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _express.Request === "undefined" ? Object : _express.Request,
        typeof _express.Response === "undefined" ? Object : _express.Response
    ]),
    _ts_metadata("design:returntype", Promise)
], PrintJobController.prototype, "createJobFromFile", null);
PrintJobController = _ts_decorate([
    (0, _awilixexpress.route)(_serverconstants.AppConstants.apiRoute + "/print-jobs"),
    (0, _awilixexpress.before)([
        (0, _authenticate.authenticate)(),
        (0, _authenticate.authorizeRoles)([
            _authorizationconstants.ROLES.ADMIN
        ])
    ]),
    _ts_metadata("design:type", Function),
    _ts_metadata("design:paramtypes", [
        typeof _loggerfactory.ILoggerFactory === "undefined" ? Object : _loggerfactory.ILoggerFactory,
        typeof _printjobservice.PrintJobService === "undefined" ? Object : _printjobservice.PrintJobService,
        typeof _fileanalysisservice.FileAnalysisService === "undefined" ? Object : _fileanalysisservice.FileAnalysisService,
        typeof _filestorageservice.FileStorageService === "undefined" ? Object : _filestorageservice.FileStorageService
    ])
], PrintJobController);

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