import { VirtualAccount } from '../entities/virtual-account.entity';
import { VirtualAccountType } from '../value-objects/virtual-account-type.enum';

/**
 * 虚拟账户仓储接口
 */
export interface IVirtualAccountRepository {
  /**
   * 保存虚拟账户
   */
  save(account: VirtualAccount): Promise<void>;

  /**
   * 批量保存虚拟账户
   */
  saveAll(accounts: VirtualAccount[]): Promise<void>;

  /**
   * 根据ID查找
   */
  findById(id: bigint): Promise<VirtualAccount | null>;

  /**
   * 根据类型查找所有账户
   */
  findByType(type: VirtualAccountType): Promise<VirtualAccount[]>;

  /**
   * 查找活跃的排名虚拟账户
   */
  findActiveRankingVirtuals(limit: number): Promise<VirtualAccount[]>;

  /**
   * 根据省份代码查找系统省公司
   */
  findByProvinceCode(provinceCode: string): Promise<VirtualAccount | null>;

  /**
   * 根据城市代码查找系统市公司
   */
  findByCityCode(cityCode: string): Promise<VirtualAccount | null>;

  /**
   * 查找总部社区账户
   */
  findHeadquarters(): Promise<VirtualAccount | null>;

  /**
   * 统计特定类型的账户数量
   */
  countByType(type: VirtualAccountType): Promise<number>;

  /**
   * 删除虚拟账户
   */
  deleteById(id: bigint): Promise<void>;
}

export const VIRTUAL_ACCOUNT_REPOSITORY = Symbol('IVirtualAccountRepository');
