import { Type } from 'class-transformer'; import { IsArray, IsBoolean, IsInt, IsOptional, IsString, Max, MaxLength, Min, MinLength, ArrayMinSize, ArrayMaxSize, } from 'class-validator'; export class UpdateConversationSettingsDto { @IsString() @MinLength(3) @MaxLength(200) chatHost!: string; @IsOptional() @IsString() @MinLength(8) @MaxLength(500) apiKey?: string; @IsOptional() @IsString() @MaxLength(500) uploadUrl?: string; @IsOptional() @IsString() @MaxLength(500) downloadUrl?: string; } export class ConversationFileBytesDto { @Type(() => Number) @IsInt() @Min(1) @Max(100 * 1024 * 1024) bytes!: number; } export class CreateConversationDmDto { @IsString() @MinLength(1) peerUserId!: string; } export class CreateConversationGroupDto { @IsString() @MinLength(2) @MaxLength(120) name!: string; @IsArray() @ArrayMinSize(1) @ArrayMaxSize(50) @IsString({ each: true }) memberUserIds!: string[]; } export class CreateConversationChannelDto { @IsString() @MinLength(2) @MaxLength(120) name!: string; @IsArray() @ArrayMinSize(1) @ArrayMaxSize(100) @IsString({ each: true }) memberUserIds!: string[]; } export class HideConversationMessagesDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsArray() @ArrayMinSize(1) @ArrayMaxSize(100) @IsString({ each: true }) messageIds!: string[]; /** true = حذف برای همه؛ false = فقط برای کاربر جاری */ @IsOptional() @IsBoolean() forEveryone?: boolean; } export class PinConversationMessageDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsString() @MinLength(1) @MaxLength(200) messageId!: string; @IsOptional() @IsString() @MaxLength(240) preview?: string; } export class UnpinConversationMessageDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; } export class PinConversationRoomDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsBoolean() pinned!: boolean; } export class ConversationRoomMembersQueryDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; } export class AddConversationRoomMemberDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsString() @MinLength(1) userId!: string; @IsOptional() @IsString() role?: 'admin' | 'member'; } export class RemoveConversationRoomMemberDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsString() @MinLength(1) userId!: string; } export class UpdateConversationRoomMemberRoleDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsString() @MinLength(1) userId!: string; @IsString() role!: 'admin' | 'member'; } export class ConversationTypingDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; } export class MuteConversationRoomDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsBoolean() muted!: boolean; @IsOptional() @IsBoolean() allowMentions?: boolean; } export class ToggleMessageReactionDto { @IsString() @MinLength(1) @MaxLength(200) externalRoomId!: string; @IsString() @MinLength(1) @MaxLength(200) messageId!: string; @IsString() @MinLength(1) @MaxLength(16) emoji!: string; }