import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { MonitoringCheckType, OperationalStatus, WebsiteCategory } from '../enums/website-monitoring.enum';
import { BreachCheckOrganizationResponseDto } from './organization-ressponse.dto';
import { BreachCheckResult } from '../entities/breach-check-result.entity';
import { BreachCheckResultResponseDto } from './breach-check-result-response.dto';

export class BreachCheckWebsiteResponseDto {
  @ApiProperty({
    description: 'Website ID',
    example: 1,
  })
  id: number;

  @ApiProperty({
    description: 'Website name',
    example: 'My E-commerce Site',
  })
  name: string;

  @ApiProperty({
    description: 'Website URL',
    example: 'https://example.com',
  })
  url: string;

  @ApiProperty({
    description: 'Website category',
    enum: WebsiteCategory,
    example: WebsiteCategory.ECOMMERCE,
  })
  category: WebsiteCategory;

  @ApiProperty({
    description: 'Monitoring frequency in minutes',
    example: 60,
  })
  monitoringFrequencyMinutes: number;

  @ApiProperty({
    description: 'Website stage',
    example: 'Scanned',
  })
  stage: 'Scanned' | 'Review' | 'Archived' | 'Deleted';

  @ApiProperty({
    description: 'Whether this is a false positive',
    example: false,
  })
  isFalsePositive: boolean;

  @ApiPropertyOptional({
    description: 'Last monitored timestamp',
    example: '2024-01-01T00:00:00.000Z',
  })
  lastMonitoredAt?: Date;

  @ApiProperty({
    description: 'Operational status',
    enum: OperationalStatus,
    example: OperationalStatus.COMPROMISED,
  })
  operationalStatus: OperationalStatus;

  @ApiProperty({
    description: 'Enabled monitoring checks',
    type: [String],
    enum: MonitoringCheckType,
  })
  enabledChecks: MonitoringCheckType[];

  @ApiProperty({
    description: 'Whether to receive alerts',
    example: true,
  })
  receiveAlerts: boolean;

  @ApiProperty({
    description: 'Alert threshold score',
    example: 50,
  })
  alertThreshold: number;

  @ApiPropertyOptional({
    description: 'Additional notes',
  })
  notes?: string;

  @ApiProperty({
    description: 'Tags',
    type: [String],
  })
  tags: string[];

  @ApiProperty({
    description: 'Organization ID',
    example: 1,
  })
  organizationId: number;

  @ApiProperty({
    description: 'Creation timestamp',
    example: '2024-01-01T00:00:00.000Z',
  })
  createdAt: Date;

  @ApiProperty({
    description: 'Last update timestamp',
    example: '2024-01-01T00:00:00.000Z',
  })
  updatedAt: Date;

  @ApiPropertyOptional({
    description: 'Associated organization',
    type: () => BreachCheckOrganizationResponseDto,
  })
  organization?: BreachCheckOrganizationResponseDto;

  // check relationships
  @ApiPropertyOptional({
    description: 'Associated checks',
    type: BreachCheckResultResponseDto,
  })
  checkRes?: BreachCheckResultResponseDto[];


  @ApiPropertyOptional({
    description:"Check content with AI",
    default: false,
  })
  checkContentWithAI?: boolean = false;
}
