/**
 * Demo presets — ported from rflows-online/lib/presets.ts.
 */

import type { FlowNode, FunnelNodeData, OutcomeNodeData, OutcomePhase, SourceNodeData } from "./types";

export const SPENDING_COLORS = ["#3b82f6", "#8b5cf6", "#ec4899", "#06b6d4", "#10b981", "#6366f1"];
export const OVERFLOW_COLORS = ["#f59e0b", "#ef4444", "#f97316", "#eab308", "#dc2626", "#ea580c"];

export const demoNodes: FlowNode[] = [
	{
		id: "revenue", type: "source", position: { x: 660, y: -200 },
		data: {
			label: "Revenue Stream", flowRate: 5000, sourceType: "card",
			targetAllocations: [{ targetId: "treasury", percentage: 100, color: "#10b981" }],
		} as SourceNodeData,
	},
	{
		id: "treasury", type: "funnel", position: { x: 630, y: 0 },
		data: {
			label: "Treasury", currentValue: 85000, desiredOutflow: 10000,
			minThreshold: 10000, sufficientThreshold: 40000, maxThreshold: 60000,
			maxCapacity: 90000, inflowRate: 1000, dynamicOverflow: true,
			overflowAllocations: [
				{ targetId: "public-goods", percentage: 40, color: OVERFLOW_COLORS[0] },
				{ targetId: "research", percentage: 35, color: OVERFLOW_COLORS[1] },
				{ targetId: "emergency", percentage: 25, color: OVERFLOW_COLORS[2] },
			],
			spendingAllocations: [
				{ targetId: "treasury-ops", percentage: 100, color: SPENDING_COLORS[0] },
			],
		} as FunnelNodeData,
	},
	{
		id: "public-goods", type: "funnel", position: { x: 170, y: 450 },
		data: {
			label: "Public Goods", currentValue: 45000, desiredOutflow: 7000,
			minThreshold: 7000, sufficientThreshold: 28000, maxThreshold: 42000,
			maxCapacity: 63000, inflowRate: 400,
			overflowAllocations: [],
			spendingAllocations: [
				{ targetId: "pg-infra", percentage: 50, color: SPENDING_COLORS[0] },
				{ targetId: "pg-education", percentage: 30, color: SPENDING_COLORS[1] },
				{ targetId: "pg-tooling", percentage: 20, color: SPENDING_COLORS[2] },
			],
		} as FunnelNodeData,
	},
	{
		id: "research", type: "funnel", position: { x: 975, y: 450 },
		data: {
			label: "Research", currentValue: 28000, desiredOutflow: 5000,
			minThreshold: 5000, sufficientThreshold: 20000, maxThreshold: 30000,
			maxCapacity: 45000, inflowRate: 350,
			overflowAllocations: [],
			spendingAllocations: [
				{ targetId: "research-grants", percentage: 70, color: SPENDING_COLORS[0] },
				{ targetId: "research-papers", percentage: 30, color: SPENDING_COLORS[1] },
			],
		} as FunnelNodeData,
	},
	{
		id: "emergency", type: "funnel", position: { x: 1320, y: 450 },
		data: {
			label: "Emergency", currentValue: 12000, desiredOutflow: 8000,
			minThreshold: 8000, sufficientThreshold: 32000, maxThreshold: 48000,
			maxCapacity: 72000, inflowRate: 250,
			overflowAllocations: [],
			spendingAllocations: [
				{ targetId: "emergency-response", percentage: 100, color: SPENDING_COLORS[0] },
			],
		} as FunnelNodeData,
	},
	{ id: "pg-infra", type: "outcome", position: { x: -50, y: 900 },
		data: {
			label: "Infrastructure", description: "Core infrastructure development",
			fundingReceived: 22000, fundingTarget: 30000, status: "in-progress",
			phases: [
				{ name: "Foundation", fundingThreshold: 10000, tasks: [
					{ label: "Server provisioning", completed: true },
					{ label: "CI/CD pipeline", completed: true },
				] },
				{ name: "Scaling", fundingThreshold: 20000, tasks: [
					{ label: "Load balancer setup", completed: true },
					{ label: "Database replication", completed: false },
				] },
				{ name: "Hardening", fundingThreshold: 30000, tasks: [
					{ label: "Security audit", completed: false },
					{ label: "Disaster recovery", completed: false },
				] },
			],
		} as OutcomeNodeData },
	{ id: "pg-education", type: "outcome", position: { x: 180, y: 900 },
		data: { label: "Education", description: "Developer education programs", fundingReceived: 12000, fundingTarget: 20000, status: "in-progress" } as OutcomeNodeData },
	{ id: "pg-tooling", type: "outcome", position: { x: 410, y: 900 },
		data: { label: "Dev Tooling", description: "Open-source developer tools", fundingReceived: 5000, fundingTarget: 15000, status: "not-started" } as OutcomeNodeData },
	{ id: "treasury-ops", type: "outcome", position: { x: 640, y: 900 },
		data: { label: "Treasury Ops", description: "Day-to-day treasury management", fundingReceived: 15000, fundingTarget: 25000, status: "in-progress" } as OutcomeNodeData },
	{ id: "research-grants", type: "outcome", position: { x: 870, y: 900 },
		data: { label: "Grants", description: "Academic research grants", fundingReceived: 18000, fundingTarget: 25000, status: "in-progress" } as OutcomeNodeData },
	{ id: "research-papers", type: "outcome", position: { x: 1100, y: 900 },
		data: { label: "Papers", description: "Peer-reviewed publications", fundingReceived: 8000, fundingTarget: 10000, status: "in-progress" } as OutcomeNodeData },
	{ id: "emergency-response", type: "outcome", position: { x: 1330, y: 900 },
		data: { label: "Response Fund", description: "Rapid response for critical issues", fundingReceived: 5000, fundingTarget: 50000, status: "not-started" } as OutcomeNodeData },
];
