/**
 * 活动类型定义
 */

export interface Activity {
  id?: number
  name: string
  description?: string
  shortLinkPrefix?: string
  startTime: string
  endTime: string
  status: ActivityStatus
  rewardType?: RewardType
  rewardAmount?: number
  rewardDesc?: string
  posterUrl?: string
  callbackUrl?: string
  createdAt?: string
  updatedAt?: string
  // P0修复：添加缺失的配置字段
  targetUsersConfig?: string | TargetUsersConfig
  pageContentConfig?: string | PageContentConfig
  rewardTiersConfig?: string | RewardTiersConfig
}

// 目标用户配置
export interface TargetUsersConfig {
  audience?: string
  conversion?: string
}

// 页面内容配置
export interface PageContentConfig {
  rewardDesc?: string
  budget?: string
  richContent?: string
  images?: string[]
}

// 奖励层级配置
export interface RewardTiersConfig {
  reward?: string
  budget?: string
  tiers?: RewardTier[]
}

export interface RewardTier {
  level: string
  threshold: number
  reward: number
}

export type ActivityStatus = 'DRAFT' | 'PENDING' | 'IN_APPROVAL' | 'APPROVED' | 'REJECTED' | 'WAITING_PUBLISH' | 'RUNNING' | 'PAUSED' | 'ENDED' | 'ARCHIVED' | 'DELETED'

export type RewardType = 'COUPON' | 'POINTS' | 'CASH' | 'GIFT'

export interface ActivityStats {
  views: number
  shares: number
  clicks: number
  conversions: number
  rewardIssued: number
}

export interface ActivityGraphData {
  dates: string[]
  views: number[]
  shares: number[]
  clicks: number[]
}

// 裂变图谱节点
export interface GraphNode {
  id: string
  label: string
  directInvites: number   // 直接邀请数
  indirectInvites: number // 间接邀请数
}

// 裂变图谱边
export interface GraphEdge {
  from: string
  to: string
}

// 裂变图谱数据
export interface ActivityGraph {
  nodes: GraphNode[]
  edges: GraphEdge[]
}

export interface LeaderboardEntry {
  rank: number
  userId: string
  userName: string
  avatar?: string      // 用户头像
  totalInvites?: number // 邀请总数
  score: number
}
