import {
  CoManagedWalletSessionEntity,
  CoManagedWalletEntity,
} from '../entities/co-managed-wallet.entity';
import { WalletSessionStatus } from '../enums/wallet-session-status.enum';

export const CO_MANAGED_WALLET_SESSION_REPOSITORY = Symbol(
  'CO_MANAGED_WALLET_SESSION_REPOSITORY',
);

export const CO_MANAGED_WALLET_REPOSITORY = Symbol('CO_MANAGED_WALLET_REPOSITORY');

/**
 * 共管钱包会话仓储接口
 */
export interface CoManagedWalletSessionRepository {
  /**
   * 保存会话
   */
  save(entity: CoManagedWalletSessionEntity): Promise<CoManagedWalletSessionEntity>;

  /**
   * 根据 ID 查找会话
   */
  findById(id: string): Promise<CoManagedWalletSessionEntity | null>;

  /**
   * 根据邀请码查找会话
   */
  findByInviteCode(inviteCode: string): Promise<CoManagedWalletSessionEntity | null>;

  /**
   * 查找用户创建的会话列表
   */
  findByCreatedBy(
    createdBy: string,
    status?: WalletSessionStatus,
  ): Promise<CoManagedWalletSessionEntity[]>;

  /**
   * 查找所有会话 (分页)
   */
  findAll(params: {
    page: number;
    pageSize: number;
    status?: WalletSessionStatus;
  }): Promise<{
    items: CoManagedWalletSessionEntity[];
    total: number;
  }>;

  /**
   * 删除会话
   */
  delete(id: string): Promise<void>;
}

/**
 * 共管钱包仓储接口
 */
export interface CoManagedWalletRepository {
  /**
   * 保存钱包
   */
  save(entity: CoManagedWalletEntity): Promise<CoManagedWalletEntity>;

  /**
   * 根据 ID 查找钱包
   */
  findById(id: string): Promise<CoManagedWalletEntity | null>;

  /**
   * 根据会话 ID 查找钱包
   */
  findBySessionId(sessionId: string): Promise<CoManagedWalletEntity | null>;

  /**
   * 查找用户创建的钱包列表
   */
  findByCreatedBy(createdBy: string): Promise<CoManagedWalletEntity[]>;

  /**
   * 查找所有钱包 (分页)
   */
  findAll(params: {
    page: number;
    pageSize: number;
  }): Promise<{
    items: CoManagedWalletEntity[];
    total: number;
  }>;

  /**
   * 删除钱包
   */
  delete(id: string): Promise<void>;
}
