import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { PrismaModule } from '@core/database/prisma/prisma.module';
import { MeetingAttendanceModule } from '@modules/meeting-attendance';
import { AdpAuthService } from './sdk/adp-auth.service';
import { AdpApiService } from './sdk/adp-api.service';
import { AdpLinkerService } from './sync/adp-linker.service';
import { AdpPtoSyncService } from './sync/adp-pto-sync.service';
import { AdpSchedulerService } from './adp-scheduler.service';
import { AdpSyncController } from './adp.controller';

/**
 * ADP 同步模块。
 *
 * 复用 platform_automation 同步中心（不自建 SyncRun 表），与 Entra LDAP_SYNC、Dingtalk DINGTALK_SYNC 对齐。
 * 详见 docs/standards/02-backend-architecture.md "外部数据同步" 章节。
 */
@Module({
  imports: [
    PrismaModule,
    ConfigModule,
    MeetingAttendanceModule, // 复用 MeetingAttendanceAuditLogWriter（单向依赖，无循环）
  ],
  controllers: [AdpSyncController],
  providers: [
    AdpAuthService,
    AdpApiService,
    AdpLinkerService,
    AdpPtoSyncService,
    AdpSchedulerService,
  ],
  exports: [AdpAuthService, AdpApiService, AdpLinkerService, AdpPtoSyncService, AdpSchedulerService],
})
export class AdpModule {}
