{
  "name": "Lead Intake - AI Summary and Reply Draft",
  "version": "sample-1",
  "purpose": "Turn a new lead form submission into a normalized lead record, a short AI summary, and an owner reply draft.",
  "nodes": [
    {
      "id": "form_trigger",
      "type": "form_trigger",
      "name": "New Lead Form",
      "outputs": ["rawLead"]
    },
    {
      "id": "normalize",
      "type": "code",
      "name": "Normalize Required Fields",
      "inputs": ["rawLead"],
      "logic": [
        "trim name, email, project_type, message",
        "derive urgency from deadline and keywords",
        "reject or flag records missing email or message"
      ],
      "outputs": ["lead"]
    },
    {
      "id": "classify",
      "type": "ai_structured_output",
      "name": "Classify Request",
      "inputs": ["lead"],
      "schema": {
        "category": ["automation", "landing_page", "assistant", "design", "unknown"],
        "summary": "string",
        "recommended_first_scope": "string",
        "risk_note": "string"
      },
      "outputs": ["leadSummary"]
    },
    {
      "id": "log",
      "type": "google_sheets_or_database",
      "name": "Append Lead Record",
      "inputs": ["lead", "leadSummary"],
      "outputs": ["leadRecord"]
    },
    {
      "id": "reply",
      "type": "template",
      "name": "Draft Owner Reply",
      "inputs": ["lead", "leadSummary"],
      "outputs": ["replyDraft"]
    },
    {
      "id": "notify",
      "type": "email_or_slack",
      "name": "Notify Owner",
      "inputs": ["leadRecord", "replyDraft"]
    }
  ],
  "test_cases": [
    "valid lead with clear automation request",
    "missing email should be flagged, not sent",
    "urgent deadline should increase priority",
    "ambiguous request should ask one clarifying question"
  ],
  "handover": [
    "workflow export",
    "field mapping",
    "test results",
    "failure handling notes",
    "next-scope recommendation"
  ]
}
