import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsEnum, IsMongoId, IsOptional, IsString, Length } from 'class-validator';
import { ReportReason } from '../../../common/enums/report-reason.enum';
import { REPORT_TARGET_TYPES, ReportTargetType } from '../schemas/report.schema';

export class CreateReportDto {
  @ApiProperty({ enum: REPORT_TARGET_TYPES })
  @IsEnum(REPORT_TARGET_TYPES)
  targetType!: ReportTargetType;

  @ApiProperty()
  @IsMongoId()
  targetId!: string;

  @ApiProperty({ enum: ReportReason })
  @IsEnum(ReportReason)
  reason!: ReportReason;

  @ApiPropertyOptional({ maxLength: 2000 })
  @IsOptional()
  @IsString()
  @Length(0, 2000)
  details?: string;

  @ApiPropertyOptional({ description: 'For user reports, block the reported user immediately' })
  @IsOptional()
  @IsBoolean()
  blockTarget?: boolean;
}
