import { IsEnum, IsOptional, IsString, IsUUID } from 'class-validator';
import type { SharePlatform } from './analytics.entity';

export class TrackShareDto {
  @IsUUID()
  articleId: string;

  @IsEnum(['facebook', 'twitter', 'instagram', 'tiktok', 'telegram', 'link'])
  platform: SharePlatform;

  @IsOptional()
  @IsString()
  userAgent?: string;

  @IsOptional()
  @IsString()
  ipAddress?: string;
}

export class GetShareStatsDto {
  @IsOptional()
  @IsUUID()
  articleId?: string;

  @IsOptional()
  @IsString()
  startDate?: string;

  @IsOptional()
  @IsString()
  endDate?: string;
}

export class ShareStatsResponse {
  articleId: string;
  articleTitle: string;
  facebookShares: number;
  twitterShares: number;
  instagramShares: number;
  tiktokShares: number;
  telegramShares: number;
  linkShares: number;
  totalShares: number;
  views: number;
  shareRate: number;
  createdAt: Date;
  updatedAt: Date;
}
