{
  "schema_version": "1.0",
  "nodes": [
    {
      "id": "brief",
      "type": "input/text",
      "label": "Campaign brief",
      "parameters": {
        "text": "Negozio: Nordlys Casa, Milano, arredo e oggetti per la casa di ispirazione nordica.\nCampagna: selezione d'autunno per chi rende la casa più calda con l'arrivo del freddo: tessili, luce, tavola.\nCanale: volantino in PDF inviato su WhatsApp ai clienti iscritti, che rispondono per prenotare.\nTono: caldo, essenziale, concreto; niente superlativi.",
        "multiline": true,
        "required": true
      }
    },
    {
      "id": "products",
      "type": "input/json_value",
      "label": "Selected products",
      "parameters": {
        "required": true
      }
    },
    {
      "id": "contact",
      "type": "input/text",
      "label": "Shop contact",
      "parameters": {
        "text": "Via Tortona 31, Milano · nordlyscasa.example · WhatsApp +39 02 555 0188",
        "multiline": false,
        "required": true
      }
    },
    {
      "id": "copywriter",
      "type": "ai/text_generation",
      "label": "Write the flyer copy",
      "parameters": {
        "system_prompt": "You write short campaign flyers for Nordlys Casa, a small homeware shop in Milan with a Nordic style.\nFrom the campaign brief, write the Italian copy of a one-page product flyer sent on WhatsApp.\n\nRules:\n- Italian, second person plural (\"voi\"), warm and concrete; no superlatives, no exclamation marks.\n- Never write prices, discounts, product names, stock or dates: the products are printed from the store catalog.\n- Keep strictly within the character limits: they are the space on the printed page.\n- The headline, the intro and the call to action each say something new: never repeat a phrase of one in another.\n\nReturn one JSON object and nothing else:\n- \"campaign_label\": at most 34 characters, e.g. \"Selezione d'autunno\".\n- \"headline\": at most 56 characters, printed on one or two lines.\n- \"intro\": 60 to 200 characters: what this selection brings to the home in this season.\n- \"cta\": at most 60 characters: invite to reply on WhatsApp to book or ask for a product.\n- \"header_image_prompt\": in English, at most 600 characters, for an image model: a wide, calm interior photograph\n  that sets the mood of the campaign (Nordic living room in autumn, warm lamp light, wool and linen, soft evening\n  light), editorial photography, muted natural colours, generous empty space on the left for text, no people,\n  no text, no logos, no brand names.",
        "response_format": "json_object",
        "temperature": 0.5,
        "max_tokens": 4000
      }
    },
    {
      "id": "copy_contract",
      "type": "utility/json_schema_validate",
      "label": "Copy fits the flyer",
      "parameters": {
        "schema_source": "inline",
        "schema_definition": {
          "$schema": "https://json-schema.org/draft/2020-12/schema",
          "type": "object",
          "additionalProperties": false,
          "required": [
            "campaign_label",
            "headline",
            "intro",
            "cta",
            "header_image_prompt"
          ],
          "properties": {
            "campaign_label": {
              "type": "string",
              "minLength": 6,
              "maxLength": 34,
              "description": "Short label above the headline."
            },
            "headline": {
              "type": "string",
              "minLength": 12,
              "maxLength": 56,
              "description": "One or two lines on the header."
            },
            "intro": {
              "type": "string",
              "minLength": 60,
              "maxLength": 200
            },
            "cta": {
              "type": "string",
              "minLength": 8,
              "maxLength": 60,
              "description": "How to book: reply on WhatsApp."
            },
            "header_image_prompt": {
              "type": "string",
              "minLength": 80,
              "maxLength": 600
            }
          }
        },
        "mode": "fail"
      }
    },
    {
      "id": "header_prompt",
      "type": "utility/extract",
      "label": "Header photo prompt",
      "parameters": {
        "path": "header_image_prompt",
        "expected_type": "text",
        "on_missing": "fail"
      }
    },
    {
      "id": "header_photo",
      "type": "ai/text_to_image",
      "label": "Paint the header",
      "parameters": {
        "aspect_ratio": "16_9",
        "variants": 1
      }
    },
    {
      "id": "render",
      "type": "design/template_render",
      "label": "Compose the flyer",
      "parameters": {
        "template_id": "__TEMPLATE_ID__",
        "template_revision": "__TEMPLATE_REVISION__",
        "output": "both",
        "page_selection": "all",
        "missing_policy": "fail_required",
        "overflow_policy": "template",
        "max_repeat": 9
      }
    },
    {
      "id": "flyer_pdf",
      "type": "output/pdf",
      "label": "Flyer — PDF",
      "parameters": {
        "output_name": "flyer_pdf"
      }
    },
    {
      "id": "flyer_image",
      "type": "output/image",
      "label": "Flyer — image for WhatsApp",
      "parameters": {
        "output_name": "flyer_image"
      }
    },
    {
      "id": "copy_output",
      "type": "output/json",
      "label": "Approved copy",
      "parameters": {
        "output_name": "flyer_copy"
      }
    },
    {
      "id": "layout_report",
      "type": "output/json",
      "label": "Layout report",
      "parameters": {
        "output_name": "layout_report"
      }
    },
    {
      "id": "header_output",
      "type": "output/image",
      "label": "Header photograph",
      "parameters": {
        "output_name": "header_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": "header_prompt",
      "to_input": "json"
    },
    {
      "from_node": "header_prompt",
      "from_output": "value",
      "to_node": "header_photo",
      "to_input": "prompt"
    },
    {
      "from_node": "copy_contract",
      "from_output": "normalized_json",
      "to_node": "render",
      "to_input": "data"
    },
    {
      "from_node": "header_photo",
      "from_output": "result",
      "to_node": "render",
      "to_input": "header_image"
    },
    {
      "from_node": "products",
      "from_output": "json",
      "to_node": "render",
      "to_input": "products"
    },
    {
      "from_node": "contact",
      "from_output": "text",
      "to_node": "render",
      "to_input": "contact"
    },
    {
      "from_node": "render",
      "from_output": "pdf",
      "to_node": "flyer_pdf",
      "to_input": "pdf"
    },
    {
      "from_node": "render",
      "from_output": "image",
      "to_node": "flyer_image",
      "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": "header_photo",
      "from_output": "result",
      "to_node": "header_output",
      "to_input": "image"
    }
  ],
  "layout": {
    "nodes": {
      "brief": {
        "x": 0,
        "y": 0
      },
      "products": {
        "x": 0,
        "y": 360
      },
      "contact": {
        "x": 0,
        "y": 560
      },
      "copywriter": {
        "x": 420,
        "y": 0
      },
      "copy_contract": {
        "x": 840,
        "y": 0
      },
      "header_prompt": {
        "x": 1260,
        "y": 120
      },
      "header_photo": {
        "x": 1680,
        "y": 120
      },
      "render": {
        "x": 2100,
        "y": 380
      },
      "flyer_pdf": {
        "x": 2580,
        "y": 300
      },
      "flyer_image": {
        "x": 2580,
        "y": 460
      },
      "copy_output": {
        "x": 2580,
        "y": 0
      },
      "layout_report": {
        "x": 2580,
        "y": 620
      },
      "header_output": {
        "x": 2100,
        "y": 120
      }
    }
  }
}
