/**
 * Graph 常量定义 — 通用调色板、尺寸参数
 * 关系类型颜色和标签由 options 动态派生，不硬编码
 */

// 通用边调色板
const EDGE_PALETTE: Array<{ base: string; light: string; glow: string }> = [
  { base: '#2563eb', light: '#60a5fa', glow: 'rgba(79,70,229,0.3)' },
  { base: '#059669', light: '#34D399', glow: 'rgba(5,150,105,0.3)' },
  { base: '#d97706', light: '#FBBF24', glow: 'rgba(217,119,6,0.3)' },
  { base: '#0891B2', light: '#22D3EE', glow: 'rgba(8,145,178,0.3)' },
  { base: '#dc2626', light: '#F87171', glow: 'rgba(220,38,38,0.3)' },
  { base: '#7C3AED', light: '#A78BFA', glow: 'rgba(124,58,237,0.3)' },
  { base: '#EA580C', light: '#FB923C', glow: 'rgba(234,88,12,0.3)' },
  { base: '#DB2777', light: '#F472B6', glow: 'rgba(219,39,119,0.3)' },
];

export const DEFAULT_REL_COLOR = { base: '#7C3AED', light: '#A78BFA', glow: 'rgba(124,58,237,0.3)' };

const edgeColorCache = new Map<string, { base: string; light: string; glow: string }>();

export function getEdgeColor(relationType: string): { base: string; light: string; glow: string } {
  const cached = edgeColorCache.get(relationType);
  if (cached) return cached;
  const color = EDGE_PALETTE[edgeColorCache.size % EDGE_PALETTE.length];
  edgeColorCache.set(relationType, color);
  return color;
}

export const NODE_BASE_RADIUS = 18;
export const NODE_CENTER_RADIUS = 26;
export const NODE_HOVER_SCALE = 1.3;
export const LABEL_MAX_LENGTH = 8;
