import { IsString, IsOptional, Length } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class WechatLoginDto {
  @ApiProperty({ description: '微信 SDK 返回的一次性 code（5 分钟有效）', example: '0b1234...' })
  @IsString()
  @Length(1, 200)
  code: string;

  @ApiPropertyOptional({ description: '推荐人的推荐码（新用户注册时使用）', example: 'ABCD1234' })
  @IsOptional()
  @IsString()
  @Length(1, 20)
  referralCode?: string;

  @ApiPropertyOptional({ description: '设备信息', example: 'iPhone 15 iOS 17' })
  @IsOptional()
  @IsString()
  deviceInfo?: string;
}
