import { Module } from '@nestjs/common';
import { PrismaService } from './persistence/prisma/prisma.service';
import { EventLogMapper } from './persistence/mappers/event-log.mapper';
import { DailyActiveStatsMapper } from './persistence/mappers/daily-active-stats.mapper';
import { OnlineSnapshotMapper } from './persistence/mappers/online-snapshot.mapper';
import { EventLogRepositoryImpl } from './persistence/repositories/event-log.repository.impl';
import { DailyActiveStatsRepositoryImpl } from './persistence/repositories/daily-active-stats.repository.impl';
import { OnlineSnapshotRepositoryImpl } from './persistence/repositories/online-snapshot.repository.impl';
import { DeviceProfileRepositoryImpl } from './persistence/repositories/device-profile.repository.impl';
import { RedisModule } from './redis/redis.module';
import { EVENT_LOG_REPOSITORY } from '../domain/repositories/event-log.repository.interface';
import { DAILY_ACTIVE_STATS_REPOSITORY } from '../domain/repositories/daily-active-stats.repository.interface';
import { ONLINE_SNAPSHOT_REPOSITORY } from '../domain/repositories/online-snapshot.repository.interface';
import { DEVICE_PROFILE_REPOSITORY } from '../domain/repositories/device-profile.repository.interface';

@Module({
  imports: [RedisModule],
  providers: [
    PrismaService,
    EventLogMapper,
    DailyActiveStatsMapper,
    OnlineSnapshotMapper,
    { provide: EVENT_LOG_REPOSITORY, useClass: EventLogRepositoryImpl },
    { provide: DAILY_ACTIVE_STATS_REPOSITORY, useClass: DailyActiveStatsRepositoryImpl },
    { provide: ONLINE_SNAPSHOT_REPOSITORY, useClass: OnlineSnapshotRepositoryImpl },
    { provide: DEVICE_PROFILE_REPOSITORY, useClass: DeviceProfileRepositoryImpl },
  ],
  exports: [
    PrismaService,
    EVENT_LOG_REPOSITORY,
    DAILY_ACTIVE_STATS_REPOSITORY,
    ONLINE_SNAPSHOT_REPOSITORY,
    DEVICE_PROFILE_REPOSITORY,
    RedisModule,
  ],
})
export class InfrastructureModule {}
