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

export class SendEmailCodeDto {
  @ApiProperty({
    example: 'user@example.com',
    description: '邮箱地址',
  })
  @IsEmail({}, { message: '请输入有效的邮箱地址' })
  email: string;

  @ApiProperty({
    example: 'BIND_EMAIL',
    description: '验证码用途: BIND_EMAIL(绑定邮箱), UNBIND_EMAIL(解绑邮箱)',
    enum: ['BIND_EMAIL', 'UNBIND_EMAIL'],
  })
  @IsString()
  @IsIn(['BIND_EMAIL', 'UNBIND_EMAIL'], { message: '无效的验证码用途' })
  purpose: 'BIND_EMAIL' | 'UNBIND_EMAIL';
}
