{
  "schema_version": "1.0",
  "nodes": [
    {
      "id": "brief",
      "type": "input/text",
      "label": "Opportunity brief",
      "parameters": {
        "text": "Cliente: Verdiana Logistica, operatore di logistica conto terzi per la grande distribuzione alimentare.\nRete: 9 magazzini nel Nord Italia, di cui 4 con celle frigorifere, attivi 24 ore su 24.\nReferente: Paola Ferri, direttrice operations. Decide insieme al CFO entro fine anno.\nSituazione: la bolletta elettrica è la seconda voce di costo dopo il personale; i consumi non sono misurati per sito\ne la direzione scopre gli sprechi solo a fine mese. Il principale cliente della GDO chiede dal 2027 un rendiconto\ndelle emissioni per ogni fornitore logistico.\nPreoccupazioni emerse: non possono fermare i magazzini per i lavori; temono un progetto lungo e poco misurabile.\nNostra proposta: audit energetico dei 9 siti, sensori e piattaforma di monitoraggio in tempo reale, riqualificazione\ndi illuminazione e celle frigorifere per fasi, rendicontazione ESG. Tono: concreto, rispettoso, senza enfasi.",
        "multiline": true,
        "required": true
      }
    },
    {
      "id": "claims",
      "type": "input/json_value",
      "label": "Approved claims",
      "parameters": {
        "required": true
      }
    },
    {
      "id": "client_name",
      "type": "input/text",
      "label": "Client name",
      "parameters": {
        "text": "Verdiana Logistica",
        "multiline": false,
        "required": true
      }
    },
    {
      "id": "client_logo",
      "type": "input/image",
      "label": "Client logo",
      "parameters": {
        "image": "__CLIENT_LOGO_ASSET_PATH__",
        "required": false
      }
    },
    {
      "id": "investment",
      "type": "input/number",
      "label": "Investment (EUR)",
      "parameters": {
        "value": 186000,
        "required": true
      }
    },
    {
      "id": "investment_note",
      "type": "input/text",
      "label": "Investment note",
      "parameters": {
        "text": "Programma di 36 mesi, IVA esclusa · offerta valida fino al 31/10/2026",
        "multiline": false,
        "required": true
      }
    },
    {
      "id": "contact",
      "type": "input/text",
      "label": "Contact",
      "parameters": {
        "text": "Giulia Serra · giulia.serra@lumen-energy.example · +39 02 555 0142",
        "multiline": false,
        "required": true
      }
    },
    {
      "id": "copywriter",
      "type": "ai/text_generation",
      "label": "Write the proposal copy",
      "parameters": {
        "system_prompt": "You are a senior B2B proposal writer for Lumen Energy Services, an energy-efficiency company.\nWrite the copy of a one-page commercial proposal in Italian, from the brief the account manager gives you.\n\nRules:\n- Use only facts contained in the brief. Do not invent clients, results or deadlines.\n- Never write numbers, percentages, prices, dates or guarantees. Approved claims and the price are printed\n  elsewhere on the page from verified sources; your copy must not restate or anticipate them.\n- Address the client company with the plural \"voi\" form, consistently in every field including the call to action;\n  concrete tone, no superlatives, no exclamation marks.\n- Keep strictly within the character limits: they are the space available on the printed page.\n\nReturn one JSON object and nothing else, with exactly these fields:\n- \"headline\": at most 70 characters, printed on one or two lines; a clear promise that names the client.\n- \"subheadline\": at most 150 characters; what the programme changes for them.\n- \"challenge\": at most 380 characters; their situation and concerns, in their own terms.\n- \"approach\": at most 380 characters; how Lumen will work, in phases, without disrupting operations.\n- \"cta\": at most 44 characters; a short imperative next step, for example a site visit.\n- \"hero_prompt\": in English, at most 700 characters; a prompt for a photorealistic, editorial wide photograph\n  that illustrates the client's world (for example a modern logistics warehouse at dawn, efficient lighting,\n  refrigerated area), calm and premium, natural colours, generous empty space in the upper part.\n  No text, no logos, no signage, no recognisable faces.",
        "response_format": "json_object",
        "temperature": 0.4,
        "max_tokens": 4000
      }
    },
    {
      "id": "copy_contract",
      "type": "utility/json_schema_validate",
      "label": "Copy fits the page",
      "parameters": {
        "schema_source": "inline",
        "schema_definition": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "$id": "urn:madoo:demo:f01-proposal-copy/v1",
          "title": "B2B proposal copy",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "headline",
            "subheadline",
            "challenge",
            "approach",
            "cta",
            "hero_prompt"
          ],
          "properties": {
            "headline": {
              "type": "string",
              "minLength": 20,
              "maxLength": 70,
              "description": "A promise that names the client, one or two lines."
            },
            "subheadline": {
              "type": "string",
              "minLength": 40,
              "maxLength": 150
            },
            "challenge": {
              "type": "string",
              "minLength": 120,
              "maxLength": 380,
              "description": "The client's situation in their terms."
            },
            "approach": {
              "type": "string",
              "minLength": 120,
              "maxLength": 380,
              "description": "How the work will be carried out."
            },
            "cta": {
              "type": "string",
              "minLength": 8,
              "maxLength": 44,
              "description": "Short imperative next step."
            },
            "hero_prompt": {
              "type": "string",
              "minLength": 80,
              "maxLength": 700,
              "description": "English prompt for the cover photograph."
            }
          }
        },
        "mode": "fail"
      }
    },
    {
      "id": "hero_prompt",
      "type": "utility/extract",
      "label": "Cover prompt",
      "parameters": {
        "path": "hero_prompt",
        "expected_type": "text",
        "on_missing": "fail"
      }
    },
    {
      "id": "hero",
      "type": "ai/text_to_image",
      "label": "Paint the cover",
      "parameters": {
        "aspect_ratio": "16_9",
        "variants": 1
      }
    },
    {
      "id": "render",
      "type": "design/template_render",
      "label": "Compose the proposal",
      "parameters": {
        "template_id": "__TEMPLATE_ID__",
        "template_revision": "__TEMPLATE_REVISION__",
        "output": "both",
        "page_selection": "all",
        "missing_policy": "fail_required",
        "overflow_policy": "template",
        "max_repeat": 10
      }
    },
    {
      "id": "proposal_pdf",
      "type": "output/pdf",
      "label": "Proposal — PDF",
      "parameters": {
        "output_name": "proposal_pdf"
      }
    },
    {
      "id": "proposal_preview",
      "type": "output/image",
      "label": "Proposal — preview",
      "parameters": {
        "output_name": "proposal_preview"
      }
    },
    {
      "id": "copy_output",
      "type": "output/json",
      "label": "Approved copy",
      "parameters": {
        "output_name": "proposal_copy"
      }
    },
    {
      "id": "layout_report",
      "type": "output/json",
      "label": "Layout report",
      "parameters": {
        "output_name": "layout_report"
      }
    },
    {
      "id": "cover_output",
      "type": "output/image",
      "label": "Cover photograph",
      "parameters": {
        "output_name": "cover_image"
      }
    }
  ],
  "connections": [
    {
      "from_node": "brief",
      "from_output": "text",
      "to_node": "copywriter",
      "to_input": "prompt"
    },
    {
      "from_node": "copywriter",
      "from_output": "json",
      "to_node": "copy_contract",
      "to_input": "document"
    },
    {
      "from_node": "copy_contract",
      "from_output": "normalized_json",
      "to_node": "hero_prompt",
      "to_input": "json"
    },
    {
      "from_node": "hero_prompt",
      "from_output": "value",
      "to_node": "hero",
      "to_input": "prompt"
    },
    {
      "from_node": "copy_contract",
      "from_output": "normalized_json",
      "to_node": "render",
      "to_input": "data"
    },
    {
      "from_node": "hero",
      "from_output": "result",
      "to_node": "render",
      "to_input": "hero_image"
    },
    {
      "from_node": "client_logo",
      "from_output": "image",
      "to_node": "render",
      "to_input": "client_logo"
    },
    {
      "from_node": "client_name",
      "from_output": "text",
      "to_node": "render",
      "to_input": "client_name"
    },
    {
      "from_node": "claims",
      "from_output": "json",
      "to_node": "render",
      "to_input": "claims"
    },
    {
      "from_node": "investment",
      "from_output": "number",
      "to_node": "render",
      "to_input": "investment"
    },
    {
      "from_node": "investment_note",
      "from_output": "text",
      "to_node": "render",
      "to_input": "investment_note"
    },
    {
      "from_node": "contact",
      "from_output": "text",
      "to_node": "render",
      "to_input": "contact"
    },
    {
      "from_node": "render",
      "from_output": "pdf",
      "to_node": "proposal_pdf",
      "to_input": "pdf"
    },
    {
      "from_node": "render",
      "from_output": "image",
      "to_node": "proposal_preview",
      "to_input": "image"
    },
    {
      "from_node": "copy_contract",
      "from_output": "normalized_json",
      "to_node": "copy_output",
      "to_input": "json"
    },
    {
      "from_node": "render",
      "from_output": "layout_report",
      "to_node": "layout_report",
      "to_input": "json"
    },
    {
      "from_node": "hero",
      "from_output": "result",
      "to_node": "cover_output",
      "to_input": "image"
    }
  ],
  "layout": {
    "nodes": {
      "brief": {
        "x": 0,
        "y": 0
      },
      "claims": {
        "x": 0,
        "y": 700
      },
      "client_name": {
        "x": 0,
        "y": 520
      },
      "client_logo": {
        "x": 0,
        "y": 340
      },
      "investment": {
        "x": 0,
        "y": 880
      },
      "investment_note": {
        "x": 0,
        "y": 1040
      },
      "contact": {
        "x": 0,
        "y": 1200
      },
      "copywriter": {
        "x": 420,
        "y": 0
      },
      "copy_contract": {
        "x": 840,
        "y": 0
      },
      "hero_prompt": {
        "x": 1260,
        "y": 120
      },
      "hero": {
        "x": 1680,
        "y": 120
      },
      "render": {
        "x": 2100,
        "y": 420
      },
      "proposal_pdf": {
        "x": 2580,
        "y": 300
      },
      "proposal_preview": {
        "x": 2580,
        "y": 460
      },
      "copy_output": {
        "x": 2580,
        "y": 0
      },
      "layout_report": {
        "x": 2580,
        "y": 620
      },
      "cover_output": {
        "x": 2100,
        "y": 120
      }
    }
  }
}
