import { Injectable } from '@nestjs/common';
import { DailyActiveStats } from '../aggregates/daily-active-stats/daily-active-stats.aggregate';
import { DauQueryResult } from '../repositories/event-log.repository.interface';

@Injectable()
export class DauCalculationService {
  createStatsFromQueryResult(day: Date, result: DauQueryResult): DailyActiveStats {
    return DailyActiveStats.create({
      day,
      dauCount: result.total,
      dauByProvince: result.byProvince,
      dauByCity: result.byCity,
    });
  }
}
