var __decorate = (this && this.__decorate) || function (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;
};
import { featureModule, Providers } from '@ditsmod/core';
import { RestModule, PreRouterExtension, RoutesExtension, initRest } from '@ditsmod/rest';
import { OpenapiCompilerExtension } from './extensions/openapi-compiler.extension.js';
import { OpenapiRoutesExtension } from './extensions/openapi-routes.extension.js';
import { OpenapiController } from './openapi.controller.js';
import { OasConfigFiles, OasExtensionConfig } from './types/oas-extension-options.js';
import { OpenapiLogMediator } from '#services/openapi-log-mediator.js';
let OpenapiModule = class OpenapiModule {
    /**
     * @param oasObject This object used for OpenAPI per application.
     * @param absolutePath This absolute path used for OpenAPI module with params.
     */
    static withParams(oasObject, absolutePath, swaggerOAuthOptions) {
        const oasExtensionConfig = {
            oasObject,
            swaggerOAuthOptions,
        };
        const initParams = new Map();
        if (absolutePath !== undefined) {
            initParams.set(initRest, { absolutePath });
        }
        return {
            module: this,
            providersPerApp: new Providers().useValue(OasExtensionConfig, oasExtensionConfig),
            initParams,
        };
    }
};
OpenapiModule = __decorate([
    initRest({
        imports: [RestModule],
        providersPerApp: [OasConfigFiles],
        providersPerMod: [OpenapiLogMediator],
        extensions: [
            { extension: OpenapiRoutesExtension, export: true },
            {
                extension: OpenapiCompilerExtension,
                afterExtensions: [RoutesExtension],
                beforeExtensions: [PreRouterExtension],
                export: true,
            },
        ],
        controllers: [OpenapiController],
        exports: [RestModule],
    }),
    featureModule()
], OpenapiModule);
export { OpenapiModule };
//# sourceMappingURL=openapi.module.js.map