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

export class TotpVerifyDto {
  @ApiProperty({ description: 'TOTP code from authenticator app', example: '123456' })
  @IsString()
  @IsNotEmpty()
  @Length(6, 6)
  token: string;

  @ApiProperty({ description: 'TOTP secret from setup step' })
  @IsString()
  @IsNotEmpty()
  secret: string;
}

export class TotpValidateDto {
  @ApiProperty({ description: 'TOTP code from authenticator app', example: '123456' })
  @IsString()
  @IsNotEmpty()
  @Length(6, 6)
  token: string;
}

export class LoginWithTotpDto {
  @ApiProperty({ description: 'Phone number' })
  @IsString()
  @IsNotEmpty()
  phone: string;

  @ApiProperty({ description: 'Password' })
  @IsString()
  @IsNotEmpty()
  password: string;

  @ApiProperty({ description: 'TOTP code (required if 2FA is enabled)', required: false })
  @IsString()
  @Length(6, 6)
  totpCode?: string;
}
