/**
 * Time series data point for charts
 */
export interface TimeSeriesDataPoint {
  timestamp: Date;
  value: number;
  label?: string;
}

/**
 * Segment condition for filtering
 */
export interface SegmentCondition {
  dimension: string;
  operator:
    | 'equals'
    | 'not_equals'
    | 'contains'
    | 'not_contains'
    | 'in'
    | 'not_in'
    | 'greater_than'
    | 'less_than'
    | 'between';
  values: string[];
}

/**
 * Segment definition
 */
export interface Segment {
  id: string;
  name: string;
  description?: string;
  conditions: SegmentCondition[];
  operator: 'AND' | 'OR';
  isBuiltIn: boolean;
  createdAt?: Date;
  updatedAt?: Date;
}

/**
 * Segment metrics from applying a segment
 */
export interface SegmentMetrics {
  segmentId: string;
  segmentName: string;
  sessions: number;
  users: number;
  engagementRate: number;
  conversionRate: number;
  avgSessionDuration: number;
  pagesPerSession: number;
  revenue: number;
}

/**
 * Funnel step definition
 */
export interface FunnelStep {
  name: string;
  count: number;
  conversionRate: number;
  dropOffRate: number;
}

/**
 * Cohort data for retention analysis
 */
export interface CohortData {
  cohortLabel: string;
  cohortSize: number;
  retention: number[];
}

/**
 * Metric card configuration
 */
export interface MetricConfig {
  label: string;
  value: number;
  previousValue?: number;
  format?: 'number' | 'percent' | 'currency' | 'duration';
  trend?: 'up' | 'down' | 'neutral';
}

/**
 * Activity feed item
 */
export interface ActivityItem {
  id: string;
  type: string;
  timestamp: Date;
  message: string;
  metadata?: Record<string, unknown>;
}

/**
 * Realtime metrics snapshot
 */
export interface RealtimeMetrics {
  activeUsers: number;
  activePages: Array<{ page: string; users: number }>;
  eventsPerMinute: number;
  recentEvents: ActivityItem[];
}
