import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; import { ConversationType } from '../schemas/conversation.schema'; import { IsEnum, IsNotEmpty, IsOptional, IsString, ArrayMinSize, ArrayUnique, IsArray, } from 'class-validator'; export class CreateConversationDto { @ApiProperty({ enum: ConversationType, enumName: 'ConversationType', example: ConversationType.GROUP, description: 'Type of the conversation', }) @IsEnum(ConversationType) @IsNotEmpty() type!: ConversationType; @ApiProperty({ type: [String], example: ['userId1', 'userId2'], description: 'List of participant user IDs', minItems: 2, }) @IsArray() @ArrayMinSize(2) @ArrayUnique() @IsString({ each: true }) @IsNotEmpty({ each: true }) participants!: string[]; @ApiPropertyOptional({ type: String, example: 'Team Chat', description: 'Name of the conversation (required for group, omit for p2p)', nullable: true, }) @IsOptional() @IsString() @IsNotEmpty() name?: string; }