import { Module, Global, forwardRef } from '@nestjs/common';
import { MetricsService } from './metrics.service';
import { MetricsController } from './metrics.controller';
import { MetricsCollectorService } from './metrics-collector.service';
import { RedisModule } from '../redis/redis.module';
import { PrismaService } from '../persistence/prisma/prisma.service';
import { DailyActiveStatsMapper } from '../persistence/mappers/daily-active-stats.mapper';
import { EventLogMapper } from '../persistence/mappers/event-log.mapper';
import { DailyActiveStatsRepositoryImpl } from '../persistence/repositories/daily-active-stats.repository.impl';
import { EventLogRepositoryImpl } from '../persistence/repositories/event-log.repository.impl';
import { DAILY_ACTIVE_STATS_REPOSITORY } from '../../domain/repositories/daily-active-stats.repository.interface';
import { EVENT_LOG_REPOSITORY } from '../../domain/repositories/event-log.repository.interface';

@Global()
@Module({
  imports: [RedisModule],
  controllers: [MetricsController],
  providers: [
    MetricsService,
    MetricsCollectorService,
    PrismaService,
    DailyActiveStatsMapper,
    EventLogMapper,
    {
      provide: DAILY_ACTIVE_STATS_REPOSITORY,
      useClass: DailyActiveStatsRepositoryImpl,
    },
    {
      provide: EVENT_LOG_REPOSITORY,
      useClass: EventLogRepositoryImpl,
    },
  ],
  exports: [MetricsService],
})
export class MetricsModule {}
