/* tslint:disable */
/* eslint-disable */
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, HttpStatusCodeLiteral, TsoaResponse, fetchMiddlewares } from '@tsoa/runtime';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { CabinetController } from './controllers/cabinetController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { DrawerController } from './controllers/drawerController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { FileController } from './controllers/fileController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { FolderController } from './controllers/folderController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { SearchController } from './controllers/searchController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { StorageController } from './controllers/storageController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { SubFolderController } from './controllers/subFolderController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { SubFolderFileController } from './controllers/subFolderFileController';
import { expressAuthentication } from './utils/auth';
// @ts-ignore - no great way to install types from subpackage
const promiseAny = require('promise.any');
import type { RequestHandler, Router } from 'express';

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

const models: TsoaRoute.Models = {
    "StorageFolder": {
        "dataType": "refObject",
        "properties": {
            "pathname": {"dataType":"string","required":true},
            "name": {"dataType":"string","required":true},
            "createdAt": {"dataType":"union","subSchemas":[{"dataType":"string"},{"dataType":"datetime"}],"required":true},
            "createdBy": {"dataType":"union","subSchemas":[{"dataType":"string"},{"dataType":"datetime"}],"required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "StorageFile": {
        "dataType": "refObject",
        "properties": {
            "pathname": {"dataType":"string","required":true},
            "fileName": {"dataType":"string","required":true},
            "fileSize": {"dataType":"double","required":true},
            "fileType": {"dataType":"string","required":true},
            "title": {"dataType":"string","required":true},
            "description": {"dataType":"string","required":true},
            "category": {"dataType":"array","array":{"dataType":"string"},"required":true},
            "keyword": {"dataType":"array","array":{"dataType":"string"},"required":true},
            "path": {"dataType":"string","required":true},
            "upload": {"dataType":"boolean","required":true},
            "updatedAt": {"dataType":"union","subSchemas":[{"dataType":"string"},{"dataType":"datetime"}],"required":true},
            "updatedBy": {"dataType":"string","required":true},
            "createdAt": {"dataType":"union","subSchemas":[{"dataType":"string"},{"dataType":"datetime"}],"required":true},
            "createdBy": {"dataType":"string","required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "Search": {
        "dataType": "refObject",
        "properties": {
            "AND": {"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"exact":{"dataType":"boolean"},"value":{"dataType":"string","required":true},"field":{"dataType":"string","required":true}}}},
            "OR": {"dataType":"array","array":{"dataType":"nestedObjectLiteral","nestedProperties":{"exact":{"dataType":"boolean"},"value":{"dataType":"string","required":true},"field":{"dataType":"string","required":true}}}},
            "exact": {"dataType":"boolean"},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "ListRequestBody": {
        "dataType": "refObject",
        "properties": {
            "operation": {"dataType":"union","subSchemas":[{"dataType":"enum","enums":["folder"]},{"dataType":"enum","enums":["file"]}],"required":true},
            "path": {"dataType":"array","array":{"dataType":"string"},"required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "FolderBody": {
        "dataType": "refObject",
        "properties": {
            "path": {"dataType":"array","array":{"dataType":"string"},"required":true},
            "name": {"dataType":"string","required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "PutFolderBody": {
        "dataType": "refObject",
        "properties": {
            "from": {"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}},"required":true},
            "to": {"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}},"required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "DeleteFolderBody": {
        "dataType": "refObject",
        "properties": {
            "path": {"dataType":"array","array":{"dataType":"string"},"required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "FileBody": {
        "dataType": "refObject",
        "properties": {
            "path": {"dataType":"array","array":{"dataType":"string"},"required":true},
            "file": {"dataType":"string","required":true},
            "title": {"dataType":"string"},
            "description": {"dataType":"string"},
            "category": {"dataType":"array","array":{"dataType":"string"}},
            "keyword": {"dataType":"array","array":{"dataType":"string"}},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "PutFileBody": {
        "dataType": "refObject",
        "properties": {
            "title": {"dataType":"string"},
            "description": {"dataType":"string"},
            "category": {"dataType":"array","array":{"dataType":"string"}},
            "keyword": {"dataType":"array","array":{"dataType":"string"}},
            "from": {"dataType":"nestedObjectLiteral","nestedProperties":{"file":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}},"required":true},
            "to": {"dataType":"nestedObjectLiteral","nestedProperties":{"file":{"dataType":"string","required":true},"path":{"dataType":"array","array":{"dataType":"string"},"required":true}}},
            "upload": {"dataType":"boolean"},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "DeleteFileBody": {
        "dataType": "refObject",
        "properties": {
            "path": {"dataType":"array","array":{"dataType":"string"},"required":true},
            "file": {"dataType":"string","required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
    "DownloadFileBody": {
        "dataType": "refObject",
        "properties": {
            "path": {"dataType":"array","array":{"dataType":"string"},"required":true},
            "file": {"dataType":"string","required":true},
        },
        "additionalProperties": false,
    },
    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
};
const validationService = new ValidationService(models);

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

export function RegisterRoutes(app: Router) {
    // ###########################################################################################################
    //  NOTE: If you do not see routes for all of your controllers in this file, then you might not have informed tsoa of where to look
    //      Please look into the "controllerPathGlobs" config option described in the readme: https://github.com/lukeautry/tsoa
    // ###########################################################################################################
        app.get('/cabinet',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(CabinetController)),
            ...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.listCabinet)),

            function CabinetController_listCabinet(request: any, response: any, next: any) {
            const args = {
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new CabinetController();


              const promise = controller.listCabinet.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/cabinet',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(CabinetController)),
            ...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.createCabinet)),

            function CabinetController_createCabinet(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new CabinetController();


              const promise = controller.createCabinet.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 201, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.put('/cabinet/:cabinetName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(CabinetController)),
            ...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.editCabinet)),

            function CabinetController_editCabinet(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new CabinetController();


              const promise = controller.editCabinet.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/cabinet/:cabinetName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(CabinetController)),
            ...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.deleteCabinet)),

            function CabinetController_deleteCabinet(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new CabinetController();


              const promise = controller.deleteCabinet.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/size',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(CabinetController)),
            ...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.calc)),

            function CabinetController_calc(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new CabinetController();


              const promise = controller.calc.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(DrawerController)),
            ...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.listDrawer)),

            function DrawerController_listDrawer(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new DrawerController();


              const promise = controller.listDrawer.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/cabinet/:cabinetName/drawer',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(DrawerController)),
            ...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.createDrawer)),

            function DrawerController_createDrawer(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new DrawerController();


              const promise = controller.createDrawer.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 201, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.put('/cabinet/:cabinetName/drawer/:drawerName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(DrawerController)),
            ...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.editDrawer)),

            function DrawerController_editDrawer(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new DrawerController();


              const promise = controller.editDrawer.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/cabinet/:cabinetName/drawer/:drawerName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(DrawerController)),
            ...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.deleteDrawer)),

            function DrawerController_deleteDrawer(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new DrawerController();


              const promise = controller.deleteDrawer.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/size',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(DrawerController)),
            ...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.calc)),

            function DrawerController_calc(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new DrawerController();


              const promise = controller.calc.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(FileController)),
            ...(fetchMiddlewares<RequestHandler>(FileController.prototype.getFile)),

            function FileController_getFile(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FileController();


              const promise = controller.getFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(FileController)),
            ...(fetchMiddlewares<RequestHandler>(FileController.prototype.uploadFile)),

            function FileController_uploadFile(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"keyword":{"dataType":"array","array":{"dataType":"string"}},"category":{"dataType":"array","array":{"dataType":"string"}},"description":{"dataType":"string"},"title":{"dataType":"string"},"file":{"dataType":"string","required":true}}},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FileController();


              const promise = controller.uploadFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 201, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.patch('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file/:fileName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(FileController)),
            ...(fetchMiddlewares<RequestHandler>(FileController.prototype.updateFile)),

            function FileController_updateFile(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"keyword":{"dataType":"array","array":{"dataType":"string"}},"category":{"dataType":"array","array":{"dataType":"string"}},"description":{"dataType":"string"},"title":{"dataType":"string"},"file":{"dataType":"string"}}},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FileController();


              const promise = controller.updateFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file/:fileName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(FileController)),
            ...(fetchMiddlewares<RequestHandler>(FileController.prototype.deleteFile)),

            function FileController_deleteFile(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FileController();


              const promise = controller.deleteFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file/:fileName',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(FileController)),
            ...(fetchMiddlewares<RequestHandler>(FileController.prototype.downloadFile)),

            function FileController_downloadFile(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FileController();


              const promise = controller.downloadFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(FolderController)),
            ...(fetchMiddlewares<RequestHandler>(FolderController.prototype.listFolder)),

            function FolderController_listFolder(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FolderController();


              const promise = controller.listFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/cabinet/:cabinetName/drawer/:drawerName/folder',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(FolderController)),
            ...(fetchMiddlewares<RequestHandler>(FolderController.prototype.createFolder)),

            function FolderController_createFolder(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FolderController();


              const promise = controller.createFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 201, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.put('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(FolderController)),
            ...(fetchMiddlewares<RequestHandler>(FolderController.prototype.editFolder)),

            function FolderController_editFolder(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FolderController();


              const promise = controller.editFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(FolderController)),
            ...(fetchMiddlewares<RequestHandler>(FolderController.prototype.deleteFolder)),

            function FolderController_deleteFolder(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FolderController();


              const promise = controller.deleteFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/size',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(FolderController)),
            ...(fetchMiddlewares<RequestHandler>(FolderController.prototype.calc)),

            function FolderController_calc(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new FolderController();


              const promise = controller.calc.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/search',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(SearchController)),
            ...(fetchMiddlewares<RequestHandler>(SearchController.prototype.searchFile)),

            function SearchController_searchFile(request: any, response: any, next: any) {
            const args = {
                    search: {"in":"body","name":"search","required":true,"ref":"Search"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SearchController();


              const promise = controller.searchFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/storage/list',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.getList)),

            function StorageController_getList(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"ref":"ListRequestBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.getList.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, undefined, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/storage/folder',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.postFolder)),

            function StorageController_postFolder(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"ref":"FolderBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.postFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.put('/storage/folder',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.moveFolder)),

            function StorageController_moveFolder(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"ref":"PutFolderBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.moveFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/storage/folder',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.deleteStorage)),

            function StorageController_deleteStorage(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"ref":"DeleteFolderBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.deleteStorage.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/storage/file',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.postFile)),

            function StorageController_postFile(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"ref":"FileBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.postFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.put('/storage/file',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.moveFile)),

            function StorageController_moveFile(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"ref":"PutFileBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.moveFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/storage/file',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.deleteFile)),

            function StorageController_deleteFile(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"ref":"DeleteFileBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.deleteFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/storage/file/download',
            authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
            ...(fetchMiddlewares<RequestHandler>(StorageController)),
            ...(fetchMiddlewares<RequestHandler>(StorageController.prototype.downloadFile)),

            function StorageController_downloadFile(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"ref":"DownloadFileBody"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new StorageController();


              const promise = controller.downloadFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController.prototype.listFolder)),

            function SubFolderController_listFolder(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderController();


              const promise = controller.listFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController.prototype.createFolder)),

            function SubFolderController_createFolder(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderController();


              const promise = controller.createFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 201, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.put('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController.prototype.editFolder)),

            function SubFolderController_editFolder(request: any, response: any, next: any) {
            const args = {
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderController();


              const promise = controller.editFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController.prototype.deleteFolder)),

            function SubFolderController_deleteFolder(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderController();


              const promise = controller.deleteFolder.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 204, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName/size',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderController.prototype.calc)),

            function SubFolderController_calc(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderController();


              const promise = controller.calc.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName/file',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController.prototype.getFile)),

            function SubFolderFileController_getFile(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderFileController();


              const promise = controller.getFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.post('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName/file',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController.prototype.uploadFile)),

            function SubFolderFileController_uploadFile(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"keyword":{"dataType":"array","array":{"dataType":"string"}},"category":{"dataType":"array","array":{"dataType":"string"}},"description":{"dataType":"string"},"title":{"dataType":"string"},"file":{"dataType":"string","required":true}}},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderFileController();


              const promise = controller.uploadFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 201, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.patch('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName/file/:fileName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController.prototype.updateFile)),

            function SubFolderFileController_updateFile(request: any, response: any, next: any) {
            const args = {
                    request: {"in":"request","name":"request","required":true,"dataType":"object"},
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
                    fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"},
                    body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"keyword":{"dataType":"array","array":{"dataType":"string"}},"category":{"dataType":"array","array":{"dataType":"string"}},"description":{"dataType":"string"},"title":{"dataType":"string"},"file":{"dataType":"string"}}},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderFileController();


              const promise = controller.updateFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.delete('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName/file/:fileName',
            authenticateMiddleware([{"bearerAuth":["admin","management-role"]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController.prototype.deleteFile)),

            function SubFolderFileController_deleteFile(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
                    fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderFileController();


              const promise = controller.deleteFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        app.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder/:subFolderName/file/:fileName',
            authenticateMiddleware([{"bearerAuth":[]}]),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController)),
            ...(fetchMiddlewares<RequestHandler>(SubFolderFileController.prototype.downloadFile)),

            function SubFolderFileController_downloadFile(request: any, response: any, next: any) {
            const args = {
                    cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
                    drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
                    folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
                    subFolderName: {"in":"path","name":"subFolderName","required":true,"dataType":"string"},
                    fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"},
            };

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            let validatedArgs: any[] = [];
            try {
                validatedArgs = getValidatedArgs(args, request, response);

                const controller = new SubFolderFileController();


              const promise = controller.downloadFile.apply(controller, validatedArgs as any);
              promiseHandler(controller, promise, response, 200, next);
            } catch (err) {
                return next(err);
            }
        });
        // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa


    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

    function authenticateMiddleware(security: TsoaRoute.Security[] = []) {
        return async function runAuthenticationMiddleware(request: any, _response: any, next: any) {

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            // keep track of failed auth attempts so we can hand back the most
            // recent one.  This behavior was previously existing so preserving it
            // here
            const failedAttempts: any[] = [];
            const pushAndRethrow = (error: any) => {
                failedAttempts.push(error);
                throw error;
            };

            const secMethodOrPromises: Promise<any>[] = [];
            for (const secMethod of security) {
                if (Object.keys(secMethod).length > 1) {
                    const secMethodAndPromises: Promise<any>[] = [];

                    for (const name in secMethod) {
                        secMethodAndPromises.push(
                            expressAuthentication(request, name, secMethod[name])
                                .catch(pushAndRethrow)
                        );
                    }

                    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

                    secMethodOrPromises.push(Promise.all(secMethodAndPromises)
                        .then(users => { return users[0]; }));
                } else {
                    for (const name in secMethod) {
                        secMethodOrPromises.push(
                            expressAuthentication(request, name, secMethod[name])
                                .catch(pushAndRethrow)
                        );
                    }
                }
            }

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

            try {
                request['user'] = await promiseAny.call(Promise, secMethodOrPromises);
                next();
            }
            catch(err) {
                // Show most recent error as response
                const error = failedAttempts.pop();
                error.status = error.status || 401;
                next(error);
            }

            // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
        }
    }

    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

    function isController(object: any): object is Controller {
        return 'getHeaders' in object && 'getStatus' in object && 'setStatus' in object;
    }

    function promiseHandler(controllerObj: any, promise: any, response: any, successStatus: any, next: any) {
        return Promise.resolve(promise)
            .then((data: any) => {
                let statusCode = successStatus;
                let headers;
                if (isController(controllerObj)) {
                    headers = controllerObj.getHeaders();
                    statusCode = controllerObj.getStatus() || statusCode;
                }

                // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

                returnHandler(response, statusCode, data, headers)
            })
            .catch((error: any) => next(error));
    }

    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

    function returnHandler(response: any, statusCode?: number, data?: any, headers: any = {}) {
        if (response.headersSent) {
            return;
        }
        Object.keys(headers).forEach((name: string) => {
            response.set(name, headers[name]);
        });
        if (data && typeof data.pipe === 'function' && data.readable && typeof data._read === 'function') {
            response.status(statusCode || 200)
            data.pipe(response);
        } else if (data !== null && data !== undefined) {
            response.status(statusCode || 200).json(data);
        } else {
            response.status(statusCode || 204).end();
        }
    }

    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

    function responder(response: any): TsoaResponse<HttpStatusCodeLiteral, unknown>  {
        return function(status, data, headers) {
            returnHandler(response, status, data, headers);
        };
    };

    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

    function getValidatedArgs(args: any, request: any, response: any): any[] {
        const fieldErrors: FieldErrors  = {};
        const values = Object.keys(args).map((key) => {
            const name = args[key].name;
            switch (args[key].in) {
                case 'request':
                    return request;
                case 'query':
                    return validationService.ValidateParam(args[key], request.query[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                case 'queries':
                    return validationService.ValidateParam(args[key], request.query, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                case 'path':
                    return validationService.ValidateParam(args[key], request.params[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                case 'header':
                    return validationService.ValidateParam(args[key], request.header(name), name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                case 'body':
                    return validationService.ValidateParam(args[key], request.body, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                case 'body-prop':
                    return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, 'body.', {"noImplicitAdditionalProperties":"throw-on-extras"});
                case 'formData':
                    if (args[key].dataType === 'file') {
                        return validationService.ValidateParam(args[key], request.file, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                    } else if (args[key].dataType === 'array' && args[key].array.dataType === 'file') {
                        return validationService.ValidateParam(args[key], request.files, name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                    } else {
                        return validationService.ValidateParam(args[key], request.body[name], name, fieldErrors, undefined, {"noImplicitAdditionalProperties":"throw-on-extras"});
                    }
                case 'res':
                    return responder(response);
            }
        });

        if (Object.keys(fieldErrors).length > 0) {
            throw new ValidateError(fieldErrors, '');
        }
        return values;
    }

    // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
}

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
