import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
import { UserRole } from 'common/enum/UserRole.enum';

export class CreateCommentDto {
  @ApiProperty({ example: 'I found the issue. It looks like the onClick handler is missing.' })
  @IsString()
  @IsNotEmpty()
  content: string;

  @ApiProperty({ example: 'user', description: 'List of roles that can view the comment', required: true, enum: UserRole })
  @IsString()
  @IsNotEmpty()
  role: UserRole;

  @ApiProperty({ required: false, example: 'https://example.com/attachment', description: 'URL of the attached file (NOT FOR FRONTEND)' })
  @IsString()
  @IsOptional()
  attachmentUrl?: string;

  @ApiProperty({
    type: 'string',
    format: 'binary',
    required: false,
    description: 'Attach a file (1 image, < 1MB)',
  })
  @IsOptional()
  attachment?: any;
}
