export const ADOPTION_INJECTION_RECORD_REPOSITORY = Symbol('ADOPTION_INJECTION_RECORD_REPOSITORY');

/**
 * 认种 fUSDT 注入分类账 DTO
 */
export interface AdoptionInjectionRecordDto {
  id?: bigint;
  adoptionId: string;
  accountSequence: string;
  treeCount: number;
  adoptionDate: Date;
  fromAddress: string;
  toAddress: string;
  amount: string;
  chainType: string;
  txHash?: string | null;
  blockNumber?: bigint | null;
  gasUsed?: string | null;
  memo?: string | null;
  status: string;
  errorMessage?: string | null;
  createdAt?: Date;
  updatedAt?: Date;
}

export interface IAdoptionInjectionRecordRepository {
  /**
   * 保存注入记录（创建或更新）
   */
  save(record: AdoptionInjectionRecordDto): Promise<AdoptionInjectionRecordDto>;

  /**
   * 根据认种ID查找（幂等性检查）
   */
  findByAdoptionId(adoptionId: string): Promise<AdoptionInjectionRecordDto | null>;

  /**
   * 根据用户账户查找所有注入记录
   */
  findByAccountSequence(accountSequence: string): Promise<AdoptionInjectionRecordDto[]>;

  /**
   * 更新转账结果（成功）
   */
  markConfirmed(id: bigint, txHash: string, blockNumber: bigint, gasUsed: string): Promise<void>;

  /**
   * 更新转账结果（失败）
   */
  markFailed(id: bigint, errorMessage: string): Promise<void>;
}
