import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
import { IsString, IsInt, Min, IsOptional } from 'class-validator'
import { Type, Transform } from 'class-transformer'

export class MobileCheckUpdateDto {
  @ApiProperty({ description: '平台', example: 'android' })
  @IsString()
  @Transform(({ value }) => value?.toLowerCase())
  platform: string

  @ApiPropertyOptional({ description: '当前版本名称', example: '1.0.0' })
  @IsOptional()
  @IsString()
  current_version?: string

  @ApiProperty({ description: '当前版本代码', example: 110 })
  @Type(() => Number)
  @IsInt()
  @Min(0)
  current_version_code: number
}
