import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'

export class VersionResponseDto {
  @ApiProperty({ description: '版本ID' })
  id: string

  @ApiProperty({ description: '平台' })
  platform: string

  @ApiProperty({ description: '版本号' })
  versionCode: number

  @ApiProperty({ description: '版本名称' })
  versionName: string

  @ApiProperty({ description: '构建号' })
  buildNumber: string

  @ApiProperty({ description: '下载地址' })
  downloadUrl: string

  @ApiProperty({ description: '文件大小' })
  fileSize: string

  @ApiProperty({ description: 'SHA256校验和' })
  fileSha256: string

  @ApiProperty({ description: '更新日志' })
  changelog: string

  @ApiProperty({ description: '是否强制更新' })
  isForceUpdate: boolean

  @ApiProperty({ description: '是否启用' })
  isEnabled: boolean

  @ApiPropertyOptional({ description: '最低操作系统版本' })
  minOsVersion: string | null

  @ApiPropertyOptional({ description: '发布日期' })
  releaseDate: Date | null

  @ApiProperty({ description: '创建时间' })
  createdAt: Date

  @ApiProperty({ description: '更新时间' })
  updatedAt: Date
}

export class UpdateCheckResultDto {
  @ApiProperty({ description: '是否需要更新' })
  needUpdate: boolean

  @ApiPropertyOptional({ description: '版本名称' })
  version?: string

  @ApiPropertyOptional({ description: '版本号' })
  versionCode?: number

  @ApiPropertyOptional({ description: '下载地址' })
  downloadUrl?: string

  @ApiPropertyOptional({ description: '文件大小（字节）' })
  fileSize?: number

  @ApiPropertyOptional({ description: '友好的文件大小' })
  fileSizeFriendly?: string

  @ApiPropertyOptional({ description: 'SHA256校验和' })
  sha256?: string

  @ApiPropertyOptional({ description: '是否强制更新' })
  forceUpdate?: boolean

  @ApiPropertyOptional({ description: '更新日志' })
  updateLog?: string

  @ApiPropertyOptional({ description: '发布日期' })
  releaseDate?: string
}
