import { ApiPropertyOptional } from '@nestjs/swagger'
import { IsString, IsBoolean, IsUrl, IsOptional, IsDateString } from 'class-validator'

export class UpdateVersionDto {
  @ApiPropertyOptional({ description: 'APK/IPA下载地址', example: 'https://example.com/app-v1.0.1.apk' })
  @IsOptional()
  @IsUrl()
  downloadUrl?: string

  @ApiPropertyOptional({ description: '文件大小(字节)', example: '52428800' })
  @IsOptional()
  @IsString()
  fileSize?: string

  @ApiPropertyOptional({ description: '文件SHA-256校验和' })
  @IsOptional()
  @IsString()
  fileSha256?: string

  @ApiPropertyOptional({ description: '更新日志' })
  @IsOptional()
  @IsString()
  changelog?: string

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

  @ApiPropertyOptional({ description: '最低操作系统版本', example: '10.0' })
  @IsOptional()
  @IsString()
  minOsVersion?: string | null

  @ApiPropertyOptional({ description: '发布日期', example: '2025-12-02T10:00:00Z' })
  @IsOptional()
  @IsDateString()
  releaseDate?: string | null
}
