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

export class RecoverByMnemonicDto {
  @ApiProperty({
    example: 'D2512110001',
    description: '账户序列号 (格式: D + YYMMDD + 5位序号)',
  })
  @IsString()
  @Matches(/^D\d{11}$/, {
    message: '账户序列号格式错误，应为 D + 年月日(6位) + 序号(5位)',
  })
  accountSequence: string;

  @ApiProperty({
    example:
      'abandon ability able about above absent absorb abstract absurd abuse access accident',
  })
  @IsString()
  @IsNotEmpty()
  mnemonic: string;

  @ApiProperty()
  @IsString()
  @IsNotEmpty()
  newDeviceId: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  deviceName?: string;
}
