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

export const SYNCED_LEGACY_USER_REPOSITORY = Symbol('SYNCED_LEGACY_USER_REPOSITORY');

/**
 * 同步的 1.0 用户数据（只读）
 */
export interface SyncedLegacyUserData {
  id: bigint;
  legacyId: bigint;
  accountSequence: AccountSequence;
  phone: Phone;
  passwordHash: string;
  nickname: string | null;
  status: string;
  legacyCreatedAt: Date;
  migratedToV2: boolean;
  migratedAt?: Date;
  syncedAt: Date;
}

/**
 * 同步的 1.0 用户仓储接口
 */
export interface SyncedLegacyUserRepository {
  /**
   * 根据手机号查找同步的 1.0 用户
   */
  findByPhone(phone: Phone): Promise<SyncedLegacyUserData | null>;

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

  /**
   * 标记用户已迁移到 V2
   */
  markAsMigrated(accountSequence: AccountSequence): Promise<void>;

  /**
   * 检查用户是否已迁移
   */
  isMigrated(accountSequence: AccountSequence): Promise<boolean>;
}
