import { AppVersion } from '../entities/app-version.entity'
import { Platform } from '../enums/platform.enum'
import { VersionCode } from '../value-objects'

export const APP_VERSION_REPOSITORY = Symbol('APP_VERSION_REPOSITORY')

export interface AppVersionRepository {
  /**
   * 保存新版本
   */
  save(appVersion: AppVersion): Promise<AppVersion>

  /**
   * 根据ID查找版本
   */
  findById(id: string): Promise<AppVersion | null>

  /**
   * 获取指定平台的最新版本
   */
  findLatestByPlatform(platform: Platform): Promise<AppVersion | null>

  /**
   * 获取指定平台所有版本列表
   */
  findAllByPlatform(platform: Platform, includeDisabled?: boolean): Promise<AppVersion[]>

  /**
   * 获取所有版本
   */
  findAll(includeDisabled?: boolean): Promise<AppVersion[]>

  /**
   * 根据平台和版本号查找
   */
  findByPlatformAndVersionCode(
    platform: Platform,
    versionCode: VersionCode,
  ): Promise<AppVersion | null>

  /**
   * 更新版本信息
   */
  update(appVersion: AppVersion): Promise<AppVersion>

  /**
   * 删除版本
   */
  delete(id: string): Promise<void>
}
