import { DomainEvent } from './domain-event.base';

export interface WalletAddressCreatedPayload {
  userId: string;
  accountSequence: string;        // 账户序列号 (格式: D + YYMMDD + 5位序号)
  publicKey: string;
  addresses: {
    chainType: string;
    address: string;
  }[];
  // 恢复助记词相关
  mnemonic?: string;              // 12词助记词 (明文)
  encryptedMnemonic?: string;     // 加密的助记词
  mnemonicHash?: string;          // 助记词哈希
  [key: string]: unknown;
}

/**
 * 钱包地址创建事件
 * 当从公钥派生出钱包地址后触发
 */
export class WalletAddressCreatedEvent extends DomainEvent {
  readonly eventType = 'blockchain.wallet.address.created';

  constructor(private readonly payload: WalletAddressCreatedPayload) {
    super();
  }

  toPayload(): WalletAddressCreatedPayload {
    return this.payload;
  }
}
