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

export class CreateConversationDto {
  @IsArray()
  @IsString({ each: true })
  participantIds!: string[];

  @ApiPropertyOptional({ default: false })
  @IsOptional()
  @Transform(toBoolean)
  @IsBoolean()
  isGroup?: boolean;

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