/**
 * 用户注册事件
 */
export class UserRegisteredEvent {
  static readonly EVENT_TYPE = 'user.registered';

  constructor(
    public readonly accountSequence: string,
    public readonly phone: string,
    public readonly source: 'V1' | 'V2',
    public readonly registeredAt: Date,
  ) {}

  toPayload(): Record<string, unknown> {
    return {
      eventType: UserRegisteredEvent.EVENT_TYPE,
      accountSequence: this.accountSequence,
      phone: this.phone,
      source: this.source,
      registeredAt: this.registeredAt.toISOString(),
    };
  }
}
