/**
 * Zulip核心服务模块
 * 
 * 功能描述：
 * - 提供Zulip技术实现相关的核心服务
 * - 封装第三方API调用和技术细节
 * - 为业务层提供抽象接口
 * 
 * 职责分离：
 * - 技术实现层：专注Zulip API集成和客户端管理
 * - 服务抽象层：为业务层提供统一的服务接口
 * 
 * 最近修改：
 * - 2026-01-07: 代码规范优化 - 修正文件夹命名(zulip->zulip_core)和文件命名规范
 * 
 * @author moyin
 * @version 1.0.1
 * @since 2025-12-31
 * @lastModified 2026-01-07
 */

import { Module } from '@nestjs/common';
import { ZulipClientService } from './services/zulip_client.service';
import { ZulipClientPoolService } from './services/zulip_client_pool.service';
import { ConfigManagerService } from './services/config_manager.service';
import { ApiKeySecurityService } from './services/api_key_security.service';
import { ErrorHandlerService } from './services/error_handler.service';
import { MonitoringService } from './services/monitoring.service';
import { StreamInitializerService } from './services/stream_initializer.service';
import { ZulipAccountService } from './services/zulip_account.service';
import { RedisModule } from '../redis/redis.module';

@Module({
  imports: [
    // Redis模块 - ApiKeySecurityService需要REDIS_SERVICE
    RedisModule,
  ],
  providers: [
    // 核心客户端服务
    {
      provide: 'ZULIP_CLIENT_SERVICE',
      useClass: ZulipClientService,
    },
    {
      provide: 'ZULIP_CLIENT_POOL_SERVICE',
      useClass: ZulipClientPoolService,
    },
    {
      provide: 'ZULIP_CONFIG_SERVICE',
      useClass: ConfigManagerService,
    },
    {
      provide: 'API_KEY_SECURITY_SERVICE',
      useClass: ApiKeySecurityService,
    },
    
    // 辅助服务
    ApiKeySecurityService,
    ErrorHandlerService,
    MonitoringService,
    StreamInitializerService,
    ZulipAccountService,
    
    // 直接提供类（用于内部依赖）
    ZulipClientService,
    ZulipClientPoolService,
    ConfigManagerService,
  ],
  exports: [
    // 导出接口标识符供业务层使用
    'ZULIP_CLIENT_SERVICE',
    'ZULIP_CLIENT_POOL_SERVICE',
    'ZULIP_CONFIG_SERVICE',
    'API_KEY_SECURITY_SERVICE',
    
    // 导出辅助服务
    ApiKeySecurityService,
    ErrorHandlerService,
    MonitoringService,
    StreamInitializerService,
    ZulipAccountService,
  ],
})
export class ZulipCoreModule {}