import { Global, Module } from '@nestjs/common'; import { AuthModule } from '../auth/auth.module'; import { PlatformModule } from '../platform/platform.module'; import { ThemeController } from './theme.controller'; import { ThemeService } from './theme.service'; import { WidgetKeysService } from './widget-keys.service'; import { WidgetConfigService } from './widget-config.service'; import { WidgetConfigController } from './widget-config.controller'; import { SetupStateService } from './setup-state.service'; import { SetupStateController } from './setup-state.controller'; import { TelephonyConfigService } from './telephony-config.service'; import { TelephonyConfigController } from './telephony-config.controller'; import { AiConfigService } from './ai-config.service'; import { AiConfigController } from './ai-config.controller'; // Central config module — owns everything in data/*.json that's editable // from the admin portal. Today: theme, widget, setup-state, telephony, ai. // // Marked @Global() so the 3 new sidecar config services (setup-state, telephony, // ai) are injectable from any module without explicit import wiring. Without this, // AuthModule + OzonetelAgentModule + MaintModule would all need to import // ConfigThemeModule, which would create a circular dependency with AuthModule // (ConfigThemeModule already imports AuthModule for SessionService). // // AuthModule is imported because WidgetKeysService depends on SessionService // (Redis-backed cache for widget site key storage). @Global() @Module({ imports: [AuthModule, PlatformModule], controllers: [ ThemeController, WidgetConfigController, SetupStateController, TelephonyConfigController, AiConfigController, ], providers: [ ThemeService, WidgetKeysService, WidgetConfigService, SetupStateService, TelephonyConfigService, AiConfigService, ], exports: [ ThemeService, WidgetKeysService, WidgetConfigService, SetupStateService, TelephonyConfigService, AiConfigService, ], }) export class ConfigThemeModule {}