"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ApiConfig = /** @class */ (function () {
    function ApiConfig(routes, converters, aliases) {
        if (converters === void 0) { converters = {}; }
        if (aliases === void 0) { aliases = {}; }
        this.routes = routes;
        this.converters = converters;
        this.aliases = aliases;
    }
    ;
    ApiConfig.prototype.getRoute = function (methodStr, path) {
        path = this.resolvePath("" + path);
        var routePath = methodStr.toLowerCase() + " " + path;
        return (routePath in this.routes) ? this.routes[routePath] : undefined;
    };
    ApiConfig.prototype.addRoute = function (methodStr, lwm2mPath, route) {
        var aliases = [];
        for (var _i = 3; _i < arguments.length; _i++) {
            aliases[_i - 3] = arguments[_i];
        }
        this.routes[methodStr.toLowerCase() + " " + lwm2mPath] = route;
        for (var _a = 0, aliases_1 = aliases; _a < aliases_1.length; _a++) {
            var alias = aliases_1[_a];
            this.aliases[alias] = lwm2mPath;
        }
        return this;
    };
    ApiConfig.prototype.getBodyConverter = function (id) {
        return this.converters[id];
    };
    ApiConfig.prototype.resolvePath = function (path) {
        path = (path in this.aliases) ? this.aliases[path] : path;
        return path;
    };
    return ApiConfig;
}());
exports.ApiConfig = ApiConfig;
