import { UserAggregate } from '../aggregates';
import { AccountSequence, Phone } from '../value-objects';

export const USER_REPOSITORY = Symbol('USER_REPOSITORY');

/**
 * 用户仓储接口
 */
export interface UserRepository {
  /**
   * 根据 ID 查找用户
   */
  findById(id: bigint): Promise<UserAggregate | null>;

  /**
   * 根据手机号查找用户
   */
  findByPhone(phone: Phone): Promise<UserAggregate | null>;

  /**
   * 根据账户序列号查找用户
   */
  findByAccountSequence(accountSequence: AccountSequence): Promise<UserAggregate | null>;

  /**
   * 保存用户（创建或更新）
   */
  save(user: UserAggregate): Promise<UserAggregate>;

  /**
   * 检查手机号是否已存在
   */
  existsByPhone(phone: Phone): Promise<boolean>;

  /**
   * 检查账户序列号是否已存在
   */
  existsByAccountSequence(accountSequence: AccountSequence): Promise<boolean>;

  /**
   * 获取下一个账户序列号
   */
  getNextAccountSequence(): Promise<AccountSequence>;
}
