import { ApiPropertyOptional } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { ArrayMaxSize, IsArray, IsOptional, IsString, Length } from 'class-validator';
import { toStringArray } from '../../../common/utils/array-transform.util';

export class UpdateCommentDto {
  @ApiPropertyOptional({ maxLength: 1000 })
  @IsOptional()
  @IsString()
  @Length(1, 1000)
  content?: string;

  @ApiPropertyOptional({ type: [String], description: 'Set mention usernames like rami_sabry (max 30)' })
  @IsOptional()
  @Transform(toStringArray)
  @IsArray()
  @ArrayMaxSize(30)
  @IsString({ each: true })
  @Length(1, 30, { each: true })
  mentionUsernames?: string[];
}
