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

export class FeedbackDto {
  @IsString()
  @IsNotEmpty()
  @Matches(/^conv_[a-z0-9A-Z_-]{8,}$/, {
    message: 'Invalid conversation ID format',
  })
  conversationId: string;

  @IsString()
  @IsNotEmpty()
  messageId: string;

  @IsString()
  @IsIn(['positive', 'negative'], {
    message: 'Feedback type must be either "positive" or "negative"',
  })
  feedbackType: 'positive' | 'negative';

  @IsOptional()
  @IsString()
  @MaxLength(1000, { message: 'Feedback text cannot exceed 1000 characters' })
  @Transform(({ value }) => value?.trim())
  feedbackText?: string;
}
