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

export interface DepositDetectedPayload {
  depositId: string;
  chainType: string;
  txHash: string;
  fromAddress: string;
  toAddress: string;
  tokenContract: string;
  amount: string;
  amountFormatted: string;
  blockNumber: string;
  blockTimestamp: string;
  accountSequence: string;  // 跨服务关联标识 (全局唯一业务ID)
  userId: string;           // 保留兼容
  [key: string]: unknown;
}

/**
 * 充值检测事件
 * 当检测到新的充值交易时触发
 */
export class DepositDetectedEvent extends DomainEvent {
  readonly eventType = 'blockchain.deposit.detected';

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

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