import { IsString, IsOptional, IsUUID, IsNotEmpty, IsDateString } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PaginationQueryDto } from './pagination.dto';

// ───────────── Admin SAR DTOs ─────────────

export class ListSarQueryDto extends PaginationQueryDto {
  @ApiPropertyOptional({ description: 'Filter by filing status (draft, filed, etc.)' })
  @IsOptional()
  @IsString()
  status?: string;
}

export class AdminCreateSarReportDto {
  @ApiProperty({ description: 'Related AML alert ID' })
  @IsUUID()
  alertId: string;

  @ApiProperty({ description: 'User ID associated with the report' })
  @IsUUID()
  userId: string;

  @ApiProperty({ description: 'Type of SAR report' })
  @IsString()
  @IsNotEmpty()
  reportType: string;

  @ApiProperty({ description: 'Narrative description of suspicious activity' })
  @IsString()
  @IsNotEmpty()
  narrative: string;
}

// ───────────── Audit Log DTOs ─────────────

export class ListAuditLogsQueryDto extends PaginationQueryDto {
  @ApiPropertyOptional({ description: 'Filter by action type' })
  @IsOptional()
  @IsString()
  action?: string;

  @ApiPropertyOptional({ description: 'Filter by admin ID' })
  @IsOptional()
  @IsUUID()
  adminId?: string;

  @ApiPropertyOptional({ description: 'Filter by resource type' })
  @IsOptional()
  @IsString()
  resource?: string;

  @ApiPropertyOptional({ description: 'Filter by start date (ISO 8601)' })
  @IsOptional()
  @IsDateString()
  startDate?: string;

  @ApiPropertyOptional({ description: 'Filter by end date (ISO 8601)' })
  @IsOptional()
  @IsDateString()
  endDate?: string;
}

// ───────────── Report Generation DTOs ─────────────

export class GenerateReportDto {
  @ApiProperty({
    description: 'Report type to generate',
    enum: ['aml', 'sar', 'travel_rule'],
    example: 'aml',
  })
  @IsString()
  @IsNotEmpty()
  reportType: string;
}
