{
 "schema_version": "1.0",
 "nodes": [
  {
   "id": "photo",
   "type": "input/image",
   "label": "Product Photo",
   "parameters": {
    "required": true
   }
  },
  {
   "id": "name",
   "type": "input/text",
   "label": "Product Name",
   "parameters": {
    "text": "",
    "multiline": false,
    "required": true
   }
  },
  {
   "id": "tagline",
   "type": "input/text",
   "label": "Tagline",
   "parameters": {
    "text": "",
    "multiline": false,
    "required": true
   }
  },
  {
   "id": "price",
   "type": "input/text",
   "label": "Price",
   "parameters": {
    "text": "",
    "multiline": false,
    "required": true
   }
  },
  {
   "id": "mark",
   "type": "input/image",
   "label": "Brand Mark",
   "parameters": {
    "required": true
   }
  },
  {
   "id": "cutout",
   "type": "ai/remove_background",
   "label": "A1 Cut Out the Product",
   "parameters": {}
  },
  {
   "id": "trim",
   "type": "image/auto_crop",
   "label": "A2 Trim to the Product",
   "parameters": {
    "autoDetect": true,
    "tolerance": 10,
    "margin": 0
   }
  },
  {
   "id": "mark_small",
   "type": "image/resize",
   "label": "A3 Mark at 120 px",
   "parameters": {
    "unit": "px",
    "width": 120,
    "height": 120,
    "mode": "fit"
   }
  },
  {
   "id": "canvas",
   "type": "image/place_on_canvas",
   "label": "B1 Pure White 2000 x 2000",
   "parameters": {
    "canvasUnit": "px",
    "canvasWidth": 2000,
    "canvasHeight": 2000,
    "backgroundColor": "#FFFFFF",
    "paddingUnit": "px",
    "padding": 170
   }
  },
  {
   "id": "jpeg",
   "type": "image/convert",
   "label": "B2 JPEG for the Marketplace",
   "parameters": {
    "format": "jpeg",
    "quality": 90
   }
  },
  {
   "id": "check",
   "type": "media/technical_info",
   "label": "B3 Check Marketplace Rules",
   "parameters": {
    "probe_level": "streams",
    "check_id": "marketplace-image",
    "policy": {
     "schema": "madoo.media-policy/v1",
     "policyId": "marketplace-main-image",
     "allowedMediaKinds": [
      "image"
     ],
     "allowedContentTypes": [
      "image/jpeg"
     ],
     "minimumWidth": 1600,
     "minimumHeight": 1600,
     "maximumSizeBytes": 10000000
    }
   }
  },
  {
   "id": "gate",
   "type": "utility/quality_gate",
   "label": "B4 Hold Back What Breaks the Rules",
   "parameters": {
    "mode": "route",
    "policy": {
     "schema": "madoo.quality-policy/v1",
     "policyId": "marketplace-delivery",
     "profile": "all_must_pass",
     "minimumScore": 1,
     "onMissing": "fail",
     "rules": [
      {
       "checkId": "marketplace-image",
       "required": true,
       "weight": 1
      }
     ]
    }
   }
  },
  {
   "id": "hero",
   "type": "ai/product_photography",
   "label": "C1 Studio Hero Shot",
   "parameters": {
    "surface": "marble_white",
    "lighting": "soft_diffused",
    "angle": "front",
    "aspect_ratio": "4_5"
   }
  },
  {
   "id": "scene",
   "type": "ai/lifestyle",
   "label": "C2 Evening Scene",
   "parameters": {
    "mood": "luxury",
    "surface": "velvet",
    "aspect_ratio": "4_5"
   }
  },
  {
   "id": "surprise",
   "type": "ai/magic_box",
   "label": "C3 A Surprise for Social",
   "parameters": {
    "creativityLevel": "high",
    "mood": "auto",
    "variants": 1
   }
  },
  {
   "id": "story_brief",
   "type": "text/template",
   "label": "C4 Write the Story Brief",
   "parameters": {
    "template": "A vertical Instagram story advertisement for the product in the image. Keep the product exactly as it is: the same shape, colours, materials and details. Stand it on deep navy velvet in soft golden evening light, with generous calm space above it. At the top, the headline \"[name]\" in an elegant ivory serif typeface. Below the headline, smaller, the line \"[tagline]\" in a light sans-serif. Near the bottom, a small ivory pill-shaped button that reads \"Shop now  [price]\". Spell every word exactly as written. No other text, letters or logos anywhere.",
    "placeholders": [
     {
      "name": "name",
      "inputPort": "name"
     },
     {
      "name": "tagline",
      "inputPort": "tagline"
     },
     {
      "name": "price",
      "inputPort": "price"
     }
    ]
   }
  },
  {
   "id": "story",
   "type": "ai/image_transform",
   "label": "C5 Story Ad, Text by the Model",
   "parameters": {},
   "model": {
    "model": "gpt-image-2-edit",
    "params": {
     "quality": "medium",
     "image_size": "portrait_16_9"
    }
   }
  },
  {
   "id": "story_up",
   "type": "ai/upscale",
   "label": "C6 Story Upscaled x2",
   "parameters": {
    "scale_factor": "2x",
    "upscale_mode": "text"
   }
  },
  {
   "id": "line",
   "type": "text/template",
   "label": "D1 Compose Name and Price",
   "parameters": {
    "template": "[name]  ·  [price]",
    "placeholders": [
     {
      "name": "name",
      "inputPort": "name"
     },
     {
      "name": "price",
      "inputPort": "price"
     }
    ]
   }
  },
  {
   "id": "hero_signed",
   "type": "image/overlay",
   "label": "D2 Sign the Hero Shot",
   "parameters": {
    "anchor": "bottomRight",
    "x": 48,
    "y": 48,
    "opacity": 100
   }
  },
  {
   "id": "post",
   "type": "image/resize_for_platform",
   "label": "D3 Instagram Post Size",
   "parameters": {
    "platform": "instagram_square",
    "format": "jpeg",
    "quality": 88
   }
  },
  {
   "id": "scene_text",
   "type": "image/text_overlay",
   "label": "D4 Name and Price on the Post",
   "parameters": {
    "typography": {
     "schema": "madoo.image-typography/v1",
     "preset": "minimal",
     "font": {
      "schema": "madoo.font-reference/v1",
      "familyGuid": "7479ebcd-027f-b80c-469e-02923b8f0741",
      "versionGuid": "88f8a3c1-ab85-24c5-3eb8-28a1a0db2be1",
      "family": "Playfair Display",
      "variant": "700",
      "weight": 700,
      "style": "normal",
      "fingerprint": "d15499d5cd5aed357f09b38ca2ebaa6fab759426e5ed1680ae7fd0870da75f9f"
     },
     "size": {
      "mode": "relative",
      "value": 5.2,
      "min": 18,
      "max": 160
     },
     "text": {
      "color": "#FFFFFF",
      "opacity": 1,
      "transform": "none",
      "letterSpacing": 0,
      "lineSpacing": 1.1
     },
     "layout": {
      "anchor": "bottom-center",
      "alignment": "center",
      "maxWidthPercent": 84,
      "maxHeightPercent": 30,
      "maxLines": 1,
      "offsetXPercent": 0,
      "offsetYPercent": 0,
      "overflow": "fit",
      "safeArea": {
       "preset": "custom",
       "topPercent": 6,
       "rightPercent": 7,
       "bottomPercent": 7,
       "leftPercent": 7
      }
     },
     "outline": {
      "enabled": false,
      "color": "#000000",
      "width": 1
     },
     "shadow": {
      "enabled": false,
      "color": "#000000",
      "opacity": 0.45,
      "offsetX": 1,
      "offsetY": 2,
      "blur": 4
     },
     "background": {
      "enabled": true,
      "color": "#141414",
      "opacity": 0.55,
      "paddingX": 22,
      "paddingY": 10
     }
    }
   }
  },
  {
   "id": "story_fit",
   "type": "image/resize_for_platform",
   "label": "D5 Story 1080 x 1920",
   "parameters": {
    "platform": "instagram_story",
    "format": "jpeg",
    "quality": 90
   }
  },
  {
   "id": "story_size",
   "type": "image/overlay",
   "label": "D6 Sign the Story",
   "parameters": {
    "anchor": "topLeft",
    "x": 48,
    "y": 48,
    "opacity": 100
   }
  },
  {
   "id": "banner",
   "type": "image/resize_for_platform",
   "label": "D8 Facebook Banner",
   "parameters": {
    "platform": "facebook_post",
    "format": "jpeg",
    "quality": 88
   }
  },
  {
   "id": "sheet",
   "type": "image/collage",
   "label": "E1 Contact Sheet",
   "parameters": {
    "layout": "horizontal",
    "width": 2400,
    "height": 640,
    "spacing": 16,
    "backgroundColor": "#F4EFE6"
   }
  },
  {
   "id": "o_marketplace_image",
   "type": "output/image",
   "label": "marketplace_image",
   "parameters": {
    "output_name": "marketplace_image"
   }
  },
  {
   "id": "o_marketplace_report",
   "type": "output/json",
   "label": "marketplace_report",
   "parameters": {
    "output_name": "marketplace_report"
   }
  },
  {
   "id": "o_hero_shot",
   "type": "output/image",
   "label": "hero_shot",
   "parameters": {
    "output_name": "hero_shot"
   }
  },
  {
   "id": "o_instagram_post",
   "type": "output/image",
   "label": "instagram_post",
   "parameters": {
    "output_name": "instagram_post"
   }
  },
  {
   "id": "o_instagram_story",
   "type": "output/image",
   "label": "instagram_story",
   "parameters": {
    "output_name": "instagram_story"
   }
  },
  {
   "id": "o_facebook_banner",
   "type": "output/image",
   "label": "facebook_banner",
   "parameters": {
    "output_name": "facebook_banner"
   }
  },
  {
   "id": "o_surprise",
   "type": "output/image",
   "label": "surprise",
   "parameters": {
    "output_name": "surprise"
   }
  },
  {
   "id": "o_contact_sheet",
   "type": "output/image",
   "label": "contact_sheet",
   "parameters": {
    "output_name": "contact_sheet"
   }
  }
 ],
 "connections": [
  {
   "from_node": "photo",
   "from_output": "image",
   "to_node": "cutout",
   "to_input": "image"
  },
  {
   "from_node": "cutout",
   "from_output": "result",
   "to_node": "trim",
   "to_input": "image"
  },
  {
   "from_node": "mark",
   "from_output": "image",
   "to_node": "mark_small",
   "to_input": "image"
  },
  {
   "from_node": "trim",
   "from_output": "result",
   "to_node": "canvas",
   "to_input": "image"
  },
  {
   "from_node": "canvas",
   "from_output": "result",
   "to_node": "jpeg",
   "to_input": "image"
  },
  {
   "from_node": "jpeg",
   "from_output": "result",
   "to_node": "check",
   "to_input": "media"
  },
  {
   "from_node": "check",
   "from_output": "quality_check",
   "to_node": "gate",
   "to_input": "checks_0"
  },
  {
   "from_node": "jpeg",
   "from_output": "result",
   "to_node": "gate",
   "to_input": "value"
  },
  {
   "from_node": "trim",
   "from_output": "result",
   "to_node": "hero",
   "to_input": "product_image"
  },
  {
   "from_node": "trim",
   "from_output": "result",
   "to_node": "scene",
   "to_input": "product_image"
  },
  {
   "from_node": "photo",
   "from_output": "image",
   "to_node": "surprise",
   "to_input": "image"
  },
  {
   "from_node": "name",
   "from_output": "text",
   "to_node": "story_brief",
   "to_input": "name"
  },
  {
   "from_node": "tagline",
   "from_output": "text",
   "to_node": "story_brief",
   "to_input": "tagline"
  },
  {
   "from_node": "price",
   "from_output": "text",
   "to_node": "story_brief",
   "to_input": "price"
  },
  {
   "from_node": "photo",
   "from_output": "image",
   "to_node": "story",
   "to_input": "images_0"
  },
  {
   "from_node": "story_brief",
   "from_output": "result",
   "to_node": "story",
   "to_input": "prompt"
  },
  {
   "from_node": "story",
   "from_output": "result",
   "to_node": "story_up",
   "to_input": "image"
  },
  {
   "from_node": "name",
   "from_output": "text",
   "to_node": "line",
   "to_input": "name"
  },
  {
   "from_node": "price",
   "from_output": "text",
   "to_node": "line",
   "to_input": "price"
  },
  {
   "from_node": "hero",
   "from_output": "result",
   "to_node": "hero_signed",
   "to_input": "base"
  },
  {
   "from_node": "mark_small",
   "from_output": "result",
   "to_node": "hero_signed",
   "to_input": "overlay"
  },
  {
   "from_node": "scene",
   "from_output": "result",
   "to_node": "post",
   "to_input": "image"
  },
  {
   "from_node": "post",
   "from_output": "result",
   "to_node": "scene_text",
   "to_input": "image"
  },
  {
   "from_node": "line",
   "from_output": "result",
   "to_node": "scene_text",
   "to_input": "text"
  },
  {
   "from_node": "story_up",
   "from_output": "result",
   "to_node": "story_fit",
   "to_input": "image"
  },
  {
   "from_node": "story_fit",
   "from_output": "result",
   "to_node": "story_size",
   "to_input": "base"
  },
  {
   "from_node": "mark_small",
   "from_output": "result",
   "to_node": "story_size",
   "to_input": "overlay"
  },
  {
   "from_node": "surprise",
   "from_output": "result",
   "to_node": "banner",
   "to_input": "image"
  },
  {
   "from_node": "jpeg",
   "from_output": "result",
   "to_node": "sheet",
   "to_input": "images_0"
  },
  {
   "from_node": "hero_signed",
   "from_output": "result",
   "to_node": "sheet",
   "to_input": "images_1"
  },
  {
   "from_node": "scene_text",
   "from_output": "result",
   "to_node": "sheet",
   "to_input": "images_2"
  },
  {
   "from_node": "story_size",
   "from_output": "result",
   "to_node": "sheet",
   "to_input": "images_3"
  },
  {
   "from_node": "banner",
   "from_output": "result",
   "to_node": "sheet",
   "to_input": "images_4"
  },
  {
   "from_node": "gate",
   "from_output": "value",
   "to_node": "o_marketplace_image",
   "to_input": "image"
  },
  {
   "from_node": "gate",
   "from_output": "report",
   "to_node": "o_marketplace_report",
   "to_input": "json"
  },
  {
   "from_node": "hero_signed",
   "from_output": "result",
   "to_node": "o_hero_shot",
   "to_input": "image"
  },
  {
   "from_node": "scene_text",
   "from_output": "result",
   "to_node": "o_instagram_post",
   "to_input": "image"
  },
  {
   "from_node": "story_size",
   "from_output": "result",
   "to_node": "o_instagram_story",
   "to_input": "image"
  },
  {
   "from_node": "banner",
   "from_output": "result",
   "to_node": "o_facebook_banner",
   "to_input": "image"
  },
  {
   "from_node": "surprise",
   "from_output": "result",
   "to_node": "o_surprise",
   "to_input": "image"
  },
  {
   "from_node": "sheet",
   "from_output": "result",
   "to_node": "o_contact_sheet",
   "to_input": "image"
  }
 ]
}