import { IsString, IsNumber, IsOptional, IsObject, Min } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class AnomalyDetectRequestDto {
  @ApiProperty({ description: 'User ID', example: 'user-123' })
  @IsString()
  userId: string;

  @ApiProperty({ description: 'Transaction type', example: 'trade' })
  @IsString()
  transactionType: string;

  @ApiProperty({ description: 'Transaction amount', example: 5000 })
  @IsNumber()
  @Min(0)
  amount: number;

  @ApiPropertyOptional({ description: 'Additional transaction metadata' })
  @IsOptional()
  @IsObject()
  metadata?: Record<string, any>;
}

export class AnomalyDetectResponseDto {
  @ApiProperty({ description: 'Whether the transaction is anomalous' })
  isAnomalous: boolean;

  @ApiProperty({ description: 'Risk score (0-100)' })
  riskScore: number;

  @ApiProperty({ description: 'Reasons for anomaly detection', type: [String] })
  reasons: string[];
}
