// 流量用户相关类型定义
export interface TrafficUser {
  id: string
  userId?: string
  sessionId: string
  ip: string
  userAgent: string
  device: {
    type: "mobile" | "tablet" | "desktop"
    brand?: string
    model?: string
    os?: string
  }
  location?: {
    country: string
    region: string
    city: string
    latitude?: number
    longitude?: number
  }
  referrer?: string
  landingPage: string
  currentPage: string
  visitTime: string
  duration: number
  pageViews: number
  isNewUser: boolean
  source: "organic" | "direct" | "social" | "email" | "ads" | "referral"
  campaign?: string
  keywords?: string[]
  events: TrafficEvent[]
}

export interface TrafficEvent {
  id: string
  type: "page_view" | "click" | "scroll" | "form_submit" | "download" | "custom"
  timestamp: string
  data: Record<string, any>
}

export interface TrafficStats {
  totalUsers: number
  newUsers: number
  returningUsers: number
  pageViews: number
  avgDuration: number
  bounceRate: number
}

export interface TrafficFilter {
  dateRange?: {
    start: string
    end: string
  }
  source?: TrafficUser["source"]
  device?: TrafficUser["device"]["type"]
  location?: string
  isNewUser?: boolean
}
