import { IsEnum, IsMongoId, IsObject, IsOptional, IsString, MaxLength } from 'class-validator';
import { NOTIFICATION_TYPES, NotificationType } from '../schemas/notification.schema';

export class CreateNotificationDto {
  @IsOptional()
  @IsString()
  @MaxLength(128)
  eventId?: string;

  @IsMongoId()
  recipientId!: string;

  @IsMongoId()
  actorId!: string;

  @IsEnum(NOTIFICATION_TYPES)
  type!: NotificationType;

  @IsOptional()
  @IsMongoId()
  referenceId?: string;

  @IsOptional()
  @IsString()
  @MaxLength(120)
  title?: string;

  @IsOptional()
  @IsString()
  @MaxLength(500)
  previewText?: string;

  @IsOptional()
  @IsString()
  @MaxLength(80)
  resourceType?: string;

  @IsOptional()
  @IsString()
  @MaxLength(240)
  deepLink?: string;

  @IsOptional()
  @IsObject()
  metadata?: Record<string, unknown>;
}
