import { IsString, IsOptional, MinLength, MaxLength, IsNotEmpty, Matches } from 'class-validator';
import { Transform } from 'class-transformer';

export class ChatMessageDto {
  @IsString()
  @IsNotEmpty()
  @MinLength(1, { message: 'Message cannot be empty' })
  @MaxLength(2000, { message: 'Message cannot exceed 2000 characters' })
  @Transform(({ value }) => value?.trim()) // Trim whitespace
  message: string;

  @IsOptional()
  @IsString()
  @Matches(/^conv_[a-zA-Z0-9_-]{8,}$/, {
    message: 'Invalid conversation ID format',
  })
  conversationId?: string;
}
