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

export class LoginEmailDto {
  @ApiProperty({ description: '邮箱地址', example: 'user@example.com' })
  @IsEmail({}, { message: '邮箱格式无效' })
  email: string;

  @ApiProperty({ description: '6位邮箱验证码', example: '123456' })
  @IsString()
  @Length(6, 6, { message: '验证码必须为6位数字' })
  emailCode: string;

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