// ─── Domain Types & Colors for the 3D Computation Graph ────────────────────

export type Domain =
  | "INPUT"
  | "SAH"
  | "ALLOCATION"
  | "RULES"
  | "CHARGEABILITY"
  | "BUDGET"
  | "ESTIMATE"
  | "COMMERCIAL"
  | "EXPERIENCE"
  | "EFFORT"
  | "SPREAD";

export const DOMAIN_COLORS: Record<Domain, string> = {
  INPUT: "#94a3b8",
  SAH: "#3b82f6",
  ALLOCATION: "#f97316",
  RULES: "#8b5cf6",
  CHARGEABILITY: "#22c55e",
  BUDGET: "#ef4444",
  ESTIMATE: "#06b6d4",
  COMMERCIAL: "#f59e0b",
  EXPERIENCE: "#ec4899",
  EFFORT: "#14b8a6",
  SPREAD: "#6366f1",
};

export const DOMAIN_LABELS: Record<Domain, string> = {
  INPUT: "Inputs",
  SAH: "SAH",
  ALLOCATION: "Allocation",
  RULES: "Rules Engine",
  CHARGEABILITY: "Chargeability",
  BUDGET: "Budget",
  ESTIMATE: "Estimates",
  COMMERCIAL: "Commercial",
  EXPERIENCE: "Experience Mult.",
  EFFORT: "Effort Rules",
  SPREAD: "Monthly Spread",
};

// ─── Graph Node / Link Types ────────────────────────────────────────────────

export interface GraphNode {
  id: string;
  label: string;
  value: number | string;
  unit: string;
  domain: Domain;
  description: string;
  formula?: string;
  level: number; // 0=Input, 1=Intermediate, 2=Derived, 3=Output
  // react-force-graph position hints
  fx?: number;
  fy?: number;
  fz?: number;
}

export interface GraphLink {
  source: string;
  target: string;
  formula: string;
  weight: number; // 1-3 for line thickness
}

export interface GraphData {
  nodes: GraphNode[];
  links: GraphLink[];
}

// ─── Resource View Mode ─────────────────────────────────────────────────────

export const RESOURCE_VIEW_DOMAINS: Domain[] = [
  "INPUT",
  "SAH",
  "ALLOCATION",
  "RULES",
  "CHARGEABILITY",
  "BUDGET",
];

export const PROJECT_VIEW_DOMAINS: Domain[] = [
  "INPUT",
  "ESTIMATE",
  "COMMERCIAL",
  "EXPERIENCE",
  "EFFORT",
  "SPREAD",
  "BUDGET",
];
