{
  "schemaVersion": "flowdrome.workflow.v1",
  "id": "",
  "name": "Pricing engine — JavaScript + C#",
  "version": "0",
  "status": "draft",
  "nodes": [
    {
      "id": "seed",
      "type": "input.inject",
      "label": "Price inputs",
      "category": "trigger",
      "config": {
        "contentType": "application/json",
        "payload": {
          "product": "WID-1",
          "cost": 6.5,
          "listPrice": 10
        }
      },
      "position": {
        "x": 0,
        "y": 0
      }
    },
    {
      "id": "margin",
      "type": "utility.javascript",
      "label": "Margin (JS)",
      "category": "script",
      "config": {
        "code": "return { ...input, margin: +((input.listPrice - input.cost) / input.listPrice * 100).toFixed(1) };",
        "outputs": [
          "output"
        ]
      },
      "position": {
        "x": 530,
        "y": 0
      }
    },
    {
      "id": "tax",
      "type": "utility.csharp",
      "label": "Tax (C#)",
      "category": "script",
      "config": {
        "code": "var d = (IDictionary<string, object?>)input; var list = Convert.ToDouble(d[\"listPrice\"]); return new Dictionary<string, object?> { [\"product\"] = d[\"product\"], [\"margin\"] = d[\"margin\"], [\"withTax\"] = Math.Round(list * 1.0825, 2) };",
        "timeoutMs": 10000
      },
      "position": {
        "x": 1060,
        "y": 0
      }
    },
    {
      "id": "out",
      "type": "utility.console",
      "label": "Price card",
      "category": "utility",
      "config": {
        "message": "{{ $json.product }}: margin {{ $json.margin }}% · shelf price {{ $json.withTax }}"
      },
      "position": {
        "x": 1590,
        "y": 0
      }
    }
  ],
  "edges": [
    {
      "id": "e0",
      "sourceNodeId": "seed",
      "sourcePort": "output",
      "targetNodeId": "margin",
      "targetPort": "input"
    },
    {
      "id": "e1",
      "sourceNodeId": "margin",
      "sourcePort": "output",
      "targetNodeId": "tax",
      "targetPort": "input"
    },
    {
      "id": "e2",
      "sourceNodeId": "tax",
      "sourcePort": "output",
      "targetNodeId": "out",
      "targetPort": "input"
    }
  ],
  "triggers": [
    {
      "id": "t0",
      "nodeId": "seed"
    }
  ],
  "meta": {
    "snippets": [],
    "source": "template-gallery",
    "description": "Two script nodes share one calculation: JavaScript computes the margin, then the sandboxed C# node applies tax — the same payload flows through both languages."
  }
}