import { IsOptional, IsString, IsInt, Min, Max, IsEnum } from 'class-validator';
import { Type } from 'class-transformer';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { EmailType, EmailStatus } from '@prisma/client';

export class FindEmailLogsDto {
  @ApiPropertyOptional({ description: 'Cursor for pagination' })
  @IsString()
  @IsOptional()
  cursor?: string;

  @ApiPropertyOptional({ description: 'Items per page (1-100)', default: 20 })
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(100)
  @IsOptional()
  limit?: number = 20;

  @ApiPropertyOptional({ description: 'Filter by email type', enum: EmailType })
  @IsEnum(EmailType)
  @IsOptional()
  type?: EmailType;

  @ApiPropertyOptional({ description: 'Filter by status', enum: EmailStatus })
  @IsEnum(EmailStatus)
  @IsOptional()
  status?: EmailStatus;
}
