import { IsString, IsEnum, IsOptional, MinLength } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { RejectionReason } from '../enums/rejection-reason.enum';

export class RejectRequestDto {
  @ApiPropertyOptional({
    description: 'Detailed remarks explaining the rejection',
    minLength: 5,
    maxLength: 1000,
    example:
      'The fire safety certificate provided is expired. Please provide an updated certificate.',
  })
  @IsOptional()
  @IsString()
  @MinLength(5, { message: 'Rejection requires detailed remarks (minimum 5 characters)' })
  remarks?: string;

  @ApiPropertyOptional({
    description: 'Comments explaining the rejection (alternative to remarks)',
    minLength: 5,
    maxLength: 1000,
  })
  @IsOptional()
  @IsString()
  @MinLength(5, { message: 'Rejection requires detailed comments (minimum 5 characters)' })
  comments?: string;

  @ApiProperty({
    description: 'Rejection reason category',
    enum: RejectionReason,
    example: RejectionReason.INCOMPLETE_DOCUMENTS,
  })
  @IsEnum(RejectionReason)
  reason: RejectionReason;

  @ApiPropertyOptional({
    description: 'ID of the reviewer who rejected the request',
    example: 'user-id-123',
  })
  @IsOptional()
  @IsString()
  rejectedBy?: string;
}
