{
  "workflow_info": {
    "name": "Batch Watermark Applier",
    "description": "Apply watermarks to multiple images with customizable positioning, opacity, and style options",
    "version": "1.0.0",
    "author": "Lilith Platform",
    "category": "utility",
    "tags": ["utility", "batch", "watermark", "branding", "protection", "bulk"],
    "estimated_time_seconds": 3,
    "gpu_requirement": "none",
    "per_image": true
  },
  "inputs": {
    "input_images": {
      "type": "image_batch",
      "required": true,
      "description": "Batch of images to watermark"
    },
    "watermark_type": {
      "type": "enum",
      "options": ["image", "text", "both"],
      "default": "image",
      "description": "Type of watermark to apply"
    },
    "watermark_image": {
      "type": "image",
      "required": false,
      "description": "Watermark image (PNG with transparency recommended)"
    },
    "watermark_text": {
      "type": "string",
      "default": "LILITH",
      "description": "Text for text watermark"
    },
    "text_font": {
      "type": "enum",
      "options": ["arial", "helvetica", "times", "roboto", "playfair", "custom"],
      "default": "roboto",
      "description": "Font for text watermark"
    },
    "text_size": {
      "type": "enum",
      "options": ["small", "medium", "large", "auto"],
      "default": "auto",
      "description": "Size of text watermark"
    },
    "text_color": {
      "type": "string",
      "default": "#FFFFFF",
      "description": "Color for text watermark"
    },
    "position": {
      "type": "enum",
      "options": [
        "center",
        "bottom_right",
        "bottom_left",
        "bottom_center",
        "top_right",
        "top_left",
        "top_center",
        "tiled"
      ],
      "default": "bottom_right",
      "description": "Watermark position"
    },
    "opacity": {
      "type": "float",
      "default": 0.5,
      "min": 0.1,
      "max": 1.0,
      "description": "Watermark opacity"
    },
    "scale_mode": {
      "type": "enum",
      "options": ["fixed", "percentage", "auto"],
      "default": "percentage",
      "description": "How to scale the watermark"
    },
    "scale_percentage": {
      "type": "integer",
      "default": 15,
      "min": 5,
      "max": 50,
      "description": "Watermark size as percentage of image"
    },
    "margin": {
      "type": "integer",
      "default": 20,
      "description": "Margin from edges in pixels"
    },
    "tile_spacing": {
      "type": "integer",
      "default": 100,
      "description": "Spacing between tiles (for tiled mode)"
    },
    "tile_rotation": {
      "type": "integer",
      "default": -30,
      "min": -90,
      "max": 90,
      "description": "Rotation angle for tiled watermarks"
    },
    "blend_mode": {
      "type": "enum",
      "options": ["normal", "multiply", "screen", "overlay", "soft_light"],
      "default": "normal",
      "description": "Blend mode for watermark"
    },
    "add_shadow": {
      "type": "boolean",
      "default": true,
      "description": "Add subtle shadow to watermark"
    },
    "shadow_opacity": {
      "type": "float",
      "default": 0.3,
      "description": "Shadow opacity"
    },
    "output_format": {
      "type": "enum",
      "options": ["png", "jpg", "webp", "same"],
      "default": "same",
      "description": "Output format (same = keep original)"
    },
    "quality": {
      "type": "integer",
      "default": 95,
      "description": "Output quality for lossy formats"
    }
  },
  "position_configs": {
    "center": { "x": "center", "y": "center" },
    "bottom_right": { "x": "right", "y": "bottom" },
    "bottom_left": { "x": "left", "y": "bottom" },
    "bottom_center": { "x": "center", "y": "bottom" },
    "top_right": { "x": "right", "y": "top" },
    "top_left": { "x": "left", "y": "top" },
    "top_center": { "x": "center", "y": "top" },
    "tiled": { "x": "tiled", "y": "tiled" }
  },
  "text_size_configs": {
    "small": { "base_size": 24, "scale_factor": 0.02 },
    "medium": { "base_size": 36, "scale_factor": 0.03 },
    "large": { "base_size": 48, "scale_factor": 0.04 },
    "auto": { "base_size": 36, "scale_factor": 0.025 }
  },
  "nodes": {
    "1": {
      "class_type": "LoadImageBatch",
      "inputs": {
        "images": "{{input_images}}"
      },
      "outputs": ["IMAGE_BATCH", "FILENAMES"]
    },
    "2": {
      "class_type": "LoadImage",
      "inputs": {
        "image": "{{watermark_image}}"
      },
      "outputs": ["IMAGE", "MASK"],
      "_comment": "Load watermark image if using image type"
    },
    "3": {
      "class_type": "TextWatermarkGenerator",
      "inputs": {
        "text": "{{watermark_text}}",
        "font": "{{text_font}}",
        "size_config": "{{text_size}}",
        "color": "{{text_color}}",
        "enabled": "{{watermark_type == 'text' or watermark_type == 'both'}}"
      },
      "outputs": ["IMAGE"],
      "_comment": "Generate text watermark"
    },
    "4": {
      "class_type": "WatermarkSelector",
      "inputs": {
        "image_watermark": ["2", 0],
        "text_watermark": ["3", 0],
        "type": "{{watermark_type}}"
      },
      "outputs": ["IMAGE"],
      "_comment": "Select or combine watermarks"
    },
    "5": {
      "class_type": "WatermarkScaler",
      "inputs": {
        "watermark": ["4", 0],
        "target_images": ["1", 0],
        "scale_mode": "{{scale_mode}}",
        "scale_percentage": "{{scale_percentage}}"
      },
      "outputs": ["IMAGE_BATCH"],
      "_comment": "Scale watermark for each image"
    },
    "6": {
      "class_type": "WatermarkShadow",
      "inputs": {
        "watermarks": ["5", 0],
        "enabled": "{{add_shadow}}",
        "opacity": "{{shadow_opacity}}",
        "offset": 3
      },
      "outputs": ["IMAGE_BATCH"],
      "_comment": "Add shadow to watermarks"
    },
    "7": {
      "class_type": "BatchWatermarkApply",
      "inputs": {
        "images": ["1", 0],
        "watermarks": ["6", 0],
        "position": "{{position}}",
        "opacity": "{{opacity}}",
        "margin": "{{margin}}",
        "blend_mode": "{{blend_mode}}",
        "tile_spacing": "{{tile_spacing}}",
        "tile_rotation": "{{tile_rotation}}"
      },
      "outputs": ["IMAGE_BATCH"]
    },
    "8": {
      "class_type": "SaveImageBatch",
      "inputs": {
        "images": ["7", 0],
        "filenames": ["1", 1],
        "format": "{{output_format}}",
        "quality": "{{quality}}",
        "filename_prefix": "watermarked_"
      },
      "outputs": []
    }
  },
  "output_spec": {
    "type": "image_batch",
    "format": "variable",
    "description": "Batch of watermarked images"
  },
  "custom_nodes_required": [
    "LoadImageBatch",
    "TextWatermarkGenerator",
    "WatermarkSelector",
    "WatermarkScaler",
    "WatermarkShadow",
    "BatchWatermarkApply",
    "SaveImageBatch"
  ],
  "preset_configurations": {
    "subtle_corner": {
      "position": "bottom_right",
      "opacity": 0.3,
      "scale_percentage": 10,
      "add_shadow": true,
      "description": "Subtle corner watermark"
    },
    "centered_overlay": {
      "position": "center",
      "opacity": 0.15,
      "scale_percentage": 40,
      "add_shadow": false,
      "description": "Large centered semi-transparent"
    },
    "tiled_protection": {
      "position": "tiled",
      "opacity": 0.2,
      "scale_percentage": 15,
      "tile_rotation": -30,
      "description": "Tiled protection pattern"
    },
    "professional_brand": {
      "position": "bottom_center",
      "opacity": 0.7,
      "scale_percentage": 12,
      "margin": 30,
      "add_shadow": true,
      "description": "Professional branding watermark"
    }
  }
}
