export type ColumnType = 'string' | 'number' | 'boolean' | 'date' | 'json'; export interface ColumnDefinition { name: string; type: ColumnType; description: string; primaryKey?: boolean; foreignKey?: { table: string; column: string; }; } export interface RelationalTable { id: string; name: string; displayName: string; description: string; columns: ColumnDefinition[]; rows: Record[]; rowCount: number; } export interface QueryResult { columns: string[]; rows: Record[]; rowCount: number; executionTimeMs: number; query: string; error?: string; queryPlan?: string; } export type AggregationFunction = 'SUM' | 'AVG' | 'COUNT' | 'MIN' | 'MAX' | 'COUNT_DISTINCT'; export interface PivotConfig { rowField: string; colField: string; valField: string; aggFunc: AggregationFunction; filterField?: string; filterValue?: string; } export interface PivotCell { value: number; count: number; formatted: string; ratio: number; // 0 to 1 for heatmap intensity } export interface PivotResult { rowKeys: string[]; colKeys: string[]; matrix: Record>; rowTotals: Record; colTotals: Record; grandTotal: number; totalRecords: number; maxVal: number; minVal: number; } export interface ReverseGraphNode { id: string; label: string; entityType: 'SINK_ENDPOINT' | 'MIXER_POOL' | 'HAWALA_RELAY' | 'SMURF_AGGREGATOR' | 'FIAT_GATEWAY' | 'ORIGIN_SOURCE' | 'PROXY_EDGE' | 'C2_CONTROLLER'; jurisdiction: string; ipOrAddress: string; riskScore: number; // 0-100 totalInflowUsd: number; totalOutflowUsd: number; depth: number; // Reverse traversal distance (0 = terminal sink, 1 = 1 hop upstream, etc.) isSanctioned: boolean; isBottleneck: boolean; x?: number; y?: number; vx?: number; vy?: number; } export interface ReverseGraphEdge { id: string; source: string; // Upstream node target: string; // Downstream node amountUsd: number; asset: string; hopType: string; isStructuring: boolean; latencyHours: number; riskTag: string; txHash: string; } export interface ReverseTraversalPath { sinkId: string; paths: string[][]; // Array of node ID sequences from sink backwards to root sources visitedNodeIds: Set; visitedEdgeIds: Set; totalUpstreamVolumeUsd: number; maxDepth: number; bottlenecks: string[]; }