import { EventLog } from '../entities/event-log.entity';
import { EventName } from '../value-objects/event-name.vo';

export interface DauQueryResult {
  total: number;
  byProvince: Map<string, number>;
  byCity: Map<string, number>;
}

export interface IEventLogRepository {
  /**
   * 批量插入事件日志
   */
  batchInsert(logs: EventLog[]): Promise<void>;

  /**
   * 插入单条事件日志
   */
  insert(log: EventLog): Promise<EventLog>;

  /**
   * 查询DAU（去重用户数）
   */
  queryDau(
    eventName: EventName,
    startTime: Date,
    endTime: Date,
  ): Promise<DauQueryResult>;

  /**
   * 按时间范围查询事件
   */
  findByTimeRange(
    eventName: EventName,
    startTime: Date,
    endTime: Date,
    limit?: number,
  ): Promise<EventLog[]>;
}

export const EVENT_LOG_REPOSITORY = Symbol('IEventLogRepository');
