import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsOptional, IsEnum, IsObject } from 'class-validator';
import { EngagementAction, EngagementEntityType } from '@core/analytics/domain/types/EngagementEvent';

export class RecordEngagementInputDTO {
  @ApiProperty({ enum: EngagementAction })
  @IsEnum(EngagementAction)
  action!: EngagementAction;

  @ApiProperty({ enum: EngagementEntityType })
  @IsEnum(EngagementEntityType)
  entityType!: EngagementEntityType;

  @ApiProperty()
  @IsString()
  entityId!: string;

  @ApiProperty({ required: false })
  @IsOptional()
  @IsString()
  actorId?: string;

  @ApiProperty({ enum: ['anonymous', 'driver', 'sponsor'] })
  @IsEnum(['anonymous', 'driver', 'sponsor'])
  actorType!: 'anonymous' | 'driver' | 'sponsor';

  @ApiProperty()
  @IsString()
  sessionId!: string;

  @ApiProperty({ required: false, type: Object })
  @IsOptional()
  @IsObject()
  metadata?: Record<string, string | number | boolean>;
}