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 { RoutingModule, PRE_ROUTER_EXTENSIONS, ROUTES_EXTENSIONS } from '@ditsmod/routing';
import { OpenapiCompilerExtension } from './extensions/openapi-compiler.extension.js';
import { OpenapiRoutesExtension } from './extensions/openapi-routes.extension.js';
import { OAS_COMPILER_EXTENSIONS } from './di-tokens.js';
import { OpenapiController } from './openapi.controller.js';
import { OasConfigFiles, OasExtensionConfig } from './types/oas-extension-options.js';
import { OpenapiLogMediator } from './services/openapi-log-mediator.js';
import { OpenapiErrorMediator } from './services/openapi-error-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 moduleWithParams = {
            module: this,
            providersPerApp: new Providers().useValue(OasExtensionConfig, oasExtensionConfig),
        };
        if (typeof absolutePath == 'string') {
            moduleWithParams.absolutePath = absolutePath;
        }
        return moduleWithParams;
    }
};
OpenapiModule = __decorate([
    featureModule({
        imports: [RoutingModule],
        controllers: [OpenapiController],
        providersPerApp: [OasConfigFiles],
        providersPerMod: [OpenapiLogMediator, OpenapiErrorMediator],
        extensions: [
            { extension: OpenapiRoutesExtension, group: ROUTES_EXTENSIONS, exported: true },
            {
                extension: OpenapiCompilerExtension,
                group: OAS_COMPILER_EXTENSIONS,
                beforeGroups: [PRE_ROUTER_EXTENSIONS],
                exported: true,
            },
        ],
        exports: [RoutingModule],
    })
], OpenapiModule);
export { OpenapiModule };
//# sourceMappingURL=openapi.module.js.map