/**
 * 每日算力快照创建事件
 * 用于通知 mining-service 进行积分股分配
 */
export class DailySnapshotCreatedEvent {
  static readonly EVENT_TYPE = 'DailySnapshotCreated';
  static readonly TOPIC = 'contribution.daily-snapshot-created';

  constructor(
    public readonly eventId: string,
    public readonly snapshotDate: string,
    public readonly networkTotalContribution: string,
    public readonly accountCount: number,
    public readonly createdAt: Date,
  ) {}

  toPayload(): Record<string, any> {
    return {
      eventId: this.eventId,
      eventType: DailySnapshotCreatedEvent.EVENT_TYPE,
      snapshotDate: this.snapshotDate,
      networkTotalContribution: this.networkTotalContribution,
      accountCount: this.accountCount,
      createdAt: this.createdAt.toISOString(),
    };
  }
}
