import { IsString, MinLength, MaxLength, Matches } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class SetPasswordDto {
  @ApiProperty({
    example: 'Abc123456',
    description: '登录密码，6-20位，包含字母和数字',
  })
  @IsString()
  @MinLength(6, { message: '密码长度至少6位' })
  @MaxLength(20, { message: '密码长度不能超过20位' })
  @Matches(/^(?=.*[A-Za-z])(?=.*\d).+$/, {
    message: '密码需包含字母和数字',
  })
  password: string;
}
