import { ApiProperty } from '@nestjs/swagger';

export class SentimentAnalysis {
  @ApiProperty({ description: 'Sentiment polarity (-1 to 1)' })
  polarity: number;

  @ApiProperty({ description: 'Sentiment subjectivity (0 to 1)' })
  subjectivity: number;
}

export class TextAnalysis {
  // @ApiProperty({ description: 'Most common words', type: [[String, Number]] })
  topWords: [string, number][];

  @ApiProperty({ description: 'Sentiment analysis' })
  sentiment: SentimentAnalysis;
}

export class FindingDetail {
  @ApiProperty({ description: 'Source URL where finding was discovered' })
  sourceUrl: string;

  @ApiProperty({ description: 'Page title' })
  title: string;

  @ApiProperty({ description: 'Context where keyword was found' })
  context: string;

  @ApiProperty({ description: 'Keywords found on the page' })
  keywords: string[];

  @ApiProperty({ description: 'Text analysis results' })
  textAnalysis?: TextAnalysis;

  @ApiProperty({ description: 'Page metadata' })
  metadata?: Record<string, string>;

  @ApiProperty({ description: 'Number of links found' })
  linksCount?: number;

  @ApiProperty({ description: 'Email addresses found' })
  emails?: string[];

  @ApiProperty({ description: 'Document links found' })
  documents?: string[];

  @ApiProperty({ description: 'Image URLs found' })
  images?: string[];

  @ApiProperty({ description: 'HTML gallery path for images' })
  imageGalleryPath?: string;

  @ApiProperty({ description: 'When the finding was discovered' })
  discoveredAt: Date;

  @ApiProperty({ description: 'Risk assessment', enum: ['low', 'medium', 'high'] })
  riskLevel: 'low' | 'medium' | 'high';

  @ApiProperty({ description: 'Confidence score (0-1)' })
  confidence: number;
}

export class FindingsResponseDto {
  @ApiProperty({ description: 'Unique monitor ID' })
  monitorId: string;

  @ApiProperty({ description: 'Website URL that was scanned' })
  websiteUrl: string;

  @ApiProperty({ description: 'Total number of findings' })
  totalFindings: number;

  @ApiProperty({ description: 'Scan configuration used' })
  scanConfig: {
    amount: number;
    scrapeContent: boolean;
    scrapeImages: boolean;
    debugMode: boolean;
  };

  @ApiProperty({ description: 'List of findings', type: [FindingDetail] })
  findings: FindingDetail[];

  @ApiProperty({ description: 'Scan execution time in milliseconds' })
  executionTime: number;

  @ApiProperty({ description: 'Scan completion timestamp' })
  completedAt: Date;
}