import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsOptional, IsObject } from 'class-validator';

/**
 * Engagement event DTO — meaningful user interactions.
 * Matches EngagementEventData from @lilith/domain-events.
 */
export class TrackEngagementDto {
  @ApiProperty({ description: 'User ID (required for engagement events)' })
  @IsString()
  userId!: string;

  @ApiProperty({
    description: 'Engagement metric type',
    enum: ['like', 'comment', 'share', 'subscribe', 'tip', 'purchase'],
    example: 'subscribe',
  })
  @IsString()
  metricType!: string;

  @ApiProperty({ description: 'Target entity ID' })
  @IsString()
  targetId!: string;

  @ApiProperty({
    description: 'Target entity type',
    enum: ['content', 'user', 'product', 'stream', 'profile'],
    example: 'profile',
  })
  @IsString()
  targetType!: string;

  @ApiProperty({ description: 'Additional engagement metadata', required: false })
  @IsOptional()
  @IsObject()
  metadata?: Record<string, unknown>;
}
