"use strict";
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;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreModule = void 0;
const api_1 = require("@hed-hog/api");
const api_locale_1 = require("@hed-hog/api-locale");
const api_mail_1 = require("@hed-hog/api-mail");
const api_pagination_1 = require("@hed-hog/api-pagination");
const api_prisma_1 = require("@hed-hog/api-prisma");
const axios_1 = require("@nestjs/axios");
const common_1 = require("@nestjs/common");
const config_1 = require("@nestjs/config");
const core_1 = require("@nestjs/core");
const access_log_interceptor_1 = require("./access-log/access-log.interceptor");
const access_log_module_1 = require("./access-log/access-log.module");
const access_log_service_1 = require("./access-log/access-log.service");
const ai_module_1 = require("./ai/ai.module");
const auth_module_1 = require("./auth/auth.module");
const system_module_1 = require("./core/system.module");
const dashboard_module_1 = require("./dashboard/dashboard.module");
const file_module_1 = require("./file/file.module");
const install_module_1 = require("./install/install.module");
const integration_module_1 = require("./integration/integration.module");
const locale_module_1 = require("./locale/locale.module");
const mail_profile_module_1 = require("./mail-profile/mail-profile.module");
const mail_sent_module_1 = require("./mail-sent/mail-sent.module");
const mail_module_1 = require("./mail/mail.module");
const mcp_chat_module_1 = require("./mcp-chat/mcp-chat.module");
const mcp_module_1 = require("./mcp/mcp.module");
const menu_module_1 = require("./menu/menu.module");
const locale_injection_middleware_1 = require("./middlewares/locale-injection.middleware");
const notification_module_1 = require("./notification/notification.module");
const oauth_module_1 = require("./oauth/oauth.module");
const pdf_module_1 = require("./pdf/pdf.module");
const profile_module_1 = require("./profile/profile.module");
const role_module_1 = require("./role/role.module");
const route_module_1 = require("./route/route.module");
const screen_module_1 = require("./screen/screen.module");
const security_module_1 = require("./security/security.module");
const session_module_1 = require("./session/session.module");
const setting_module_1 = require("./setting/setting.module");
const setting_service_1 = require("./setting/setting.service");
const task_module_1 = require("./task/task.module");
const user_module_1 = require("./user/user.module");
const is_email_with_settings_validator_1 = require("./validators/is-email-with-settings.validator");
const is_pin_code_with_setting_validator_1 = require("./validators/is-pin-code-with-setting.validator");
const is_strong_password_with_settings_validator_1 = require("./validators/is-strong-password-with-settings.validator");
const service_locator_1 = require("./validators/service-locator");
const webhook_integration_module_1 = require("./webhook-integration/webhook-integration.module");
let CoreModule = class CoreModule {
    constructor(settingService) {
        this.settingService = settingService;
    }
    onModuleInit() {
        // Initialize the service locator for validators
        service_locator_1.ValidatorServiceLocator.setSettingService(this.settingService);
    }
    configure(consumer) {
        consumer
            .apply(locale_injection_middleware_1.LocaleInjectionMiddleware)
            .forRoutes('*');
    }
};
exports.CoreModule = CoreModule;
exports.CoreModule = CoreModule = __decorate([
    (0, common_1.Global)(),
    (0, common_1.Module)({
        imports: [
            axios_1.HttpModule,
            config_1.ConfigModule.forRoot(),
            (0, common_1.forwardRef)(() => ai_module_1.AiModule),
            (0, common_1.forwardRef)(() => install_module_1.InstallModule),
            (0, common_1.forwardRef)(() => auth_module_1.AuthModule),
            (0, common_1.forwardRef)(() => dashboard_module_1.DashboardModule),
            (0, common_1.forwardRef)(() => api_mail_1.MailModule),
            (0, common_1.forwardRef)(() => menu_module_1.MenuModule),
            (0, common_1.forwardRef)(() => api_pagination_1.PaginationModule),
            (0, common_1.forwardRef)(() => role_module_1.RoleModule),
            (0, common_1.forwardRef)(() => route_module_1.RouteModule),
            (0, common_1.forwardRef)(() => api_prisma_1.PrismaModule),
            (0, common_1.forwardRef)(() => screen_module_1.ScreenModule),
            (0, common_1.forwardRef)(() => api_locale_1.LocaleModule),
            (0, common_1.forwardRef)(() => locale_module_1.LocaleModule),
            (0, common_1.forwardRef)(() => user_module_1.UserModule),
            (0, common_1.forwardRef)(() => system_module_1.SystemModule),
            (0, common_1.forwardRef)(() => setting_module_1.SettingModule),
            (0, common_1.forwardRef)(() => mail_module_1.MailModule),
            (0, common_1.forwardRef)(() => mail_profile_module_1.MailProfileModule),
            (0, common_1.forwardRef)(() => mail_sent_module_1.MailSentModule),
            (0, common_1.forwardRef)(() => file_module_1.FileModule),
            (0, common_1.forwardRef)(() => task_module_1.TaskModule),
            (0, common_1.forwardRef)(() => security_module_1.SecurityModule),
            (0, common_1.forwardRef)(() => profile_module_1.ProfileModule),
            (0, common_1.forwardRef)(() => session_module_1.SessionModule),
            (0, common_1.forwardRef)(() => oauth_module_1.OAuthModule),
            (0, common_1.forwardRef)(() => integration_module_1.IntegrationModule),
            (0, common_1.forwardRef)(() => webhook_integration_module_1.WebhookIntegrationModule),
            (0, common_1.forwardRef)(() => mcp_module_1.McpModule),
            (0, common_1.forwardRef)(() => mcp_chat_module_1.McpChatModule),
            (0, common_1.forwardRef)(() => pdf_module_1.PdfModule),
            (0, common_1.forwardRef)(() => notification_module_1.NotificationModule),
            (0, common_1.forwardRef)(() => access_log_module_1.AccessLogModule),
        ],
        exports: [
            user_module_1.UserModule,
            auth_module_1.AuthModule,
            mail_module_1.MailModule,
            mail_profile_module_1.MailProfileModule,
            route_module_1.RouteModule,
            role_module_1.RoleModule,
            menu_module_1.MenuModule,
            screen_module_1.ScreenModule,
            api_locale_1.LocaleModule,
            locale_module_1.LocaleModule,
            setting_module_1.SettingModule,
            file_module_1.FileModule,
            session_module_1.SessionModule,
            ai_module_1.AiModule,
            integration_module_1.IntegrationModule,
            webhook_integration_module_1.WebhookIntegrationModule,
            is_strong_password_with_settings_validator_1.IsStrongPasswordWithSettingsConstraint,
            is_email_with_settings_validator_1.IsEmailWithSettingsConstraint,
            is_pin_code_with_setting_validator_1.IsPinCodeWithSettingConstraint,
            pdf_module_1.PdfModule,
            notification_module_1.NotificationModule,
            access_log_module_1.AccessLogModule,
        ],
        providers: [
            core_1.Reflector,
            is_strong_password_with_settings_validator_1.IsStrongPasswordWithSettingsConstraint,
            is_email_with_settings_validator_1.IsEmailWithSettingsConstraint,
            is_pin_code_with_setting_validator_1.IsPinCodeWithSettingConstraint,
            {
                provide: core_1.APP_INTERCEPTOR,
                useFactory: (reflector, prismaService) => {
                    return new api_1.LogInterceptor(reflector, prismaService);
                },
                inject: [core_1.Reflector, api_prisma_1.PrismaService],
            },
            {
                provide: core_1.APP_INTERCEPTOR,
                useFactory: (accessLogService) => {
                    return new access_log_interceptor_1.AccessLogInterceptor(accessLogService);
                },
                inject: [access_log_service_1.AccessLogService],
            },
        ]
    }),
    __param(0, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
    __metadata("design:paramtypes", [setting_service_1.SettingService])
], CoreModule);
//# sourceMappingURL=core.module.js.map