import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsMongoId, IsOptional, IsString, IsUrl, Length } from 'class-validator';

export class SendMessageDto {
  @IsString()
  conversationId!: string;

  @ApiPropertyOptional({ maxLength: 4000 })
  @IsOptional()
  @IsString()
  @Length(1, 4000)
  content?: string;

  @ApiPropertyOptional({ enum: ['text', 'image', 'video', 'audio'], default: 'text' })
  @IsOptional()
  @IsEnum(['text', 'image', 'video', 'audio'])
  messageType?: 'text' | 'image' | 'video' | 'audio';

  @ApiPropertyOptional()
  @IsOptional()
  @IsUrl({ require_tld: false })
  mediaUrl?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsMongoId()
  replyToMessageId?: string;
}
