{
  "$schema": "https://json-schema.org/draft-04/schema#",
  "description": "WDP Pipeline Flow UI Schema. Defines UI-only constructs for pipeline flow documents.",
  "type": "object",
  "id": "https://api.dataplatform.ibm.com/schemas/common-pipeline/pipeline-flow/pipeline-flow-ui-v3-schema.json",
  "properties": {},
  "additionalProperties": true,
  "definitions": {
    "pipeline_flow_ui_def": {
      "description": "Pipeline flow UI properties.",
      "type": "object",
      "properties": {
        "name": {
          "description": "User-defined name",
          "type": "string"
        },
        "description": {
          "description": "User-defined description",
          "type": "string"
        },
        "class_name": {
          "description": "CSS class name",
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "pipeline_ui_def": {
      "description": "Pipeline UI properties",
      "type": "object",
      "properties": {
        "description": {
          "description": "User-defined description",
          "type": "string"
        },
        "zoom": {
          "description": "X/Y pan and scale amounts for the canvas.",
          "type": "object",
          "$ref": "#/definitions/zoom_object_def"
        },
        "comments": {
          "description": "Array of Comments, optionally associated with nodes",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/comment_def"
          },
          "uniqueItems": true
        }
      },
      "additionalProperties": true
    },
    "zoom_object_def": {
      "oneOf": [
        {
          "description": "Deprecated - use zoom object instead. Scale factor as a percentage. 100% is standard scale amount. Smaller values zoom out. Larger values zoom in.",
          "type": "integer",
          "deprecated": true
        },
        {
          "description": "A zoom object containing translation and scale amounts.",
          "type": "object",
          "properties": {
            "x": {
              "description": "Horizontal translation amount. Positive value moves right, negative to the left.",
              "type": "number"
            },
            "y": {
              "description": "Vertical translation amount. Positive value moves down, negative moves up.",
              "type": "number"
            },
            "k": {
              "description": "Scale amount. 1.0 is the standard scale amount. Smaller values zoom out. Larger values zoom in.",
              "type": "number"
            }
          },
          "required": [
            "x",
            "y",
            "k"
          ],
          "additionalProperties": false
        }
      ]
    },
    "port_ui_def": {
      "description": "Port UI properties ",
      "type": "object",
      "properties": {
        "cardinality": {
          "description": "Property to capture how many data assets are allowed for this port, e.g., min: 1, max:1 implies you must supply 1 and only 1; min:0, max:1 implies it is optional and a max of one, min:0, max:-1 means it is optional and you can may have any number of data assets. The default value is 1:1 for inputs and 1:-1 for outputs.",
          "type": "object",
          "properties": {
            "min": {
              "description": "Minimum data sets that are required for this port",
              "type": "integer",
              "default": 1
            },
            "max": {
              "description": "Maximum data sets that are allowed on this port. A negative value indicates unlimited. The default value is 1 for inputs and -1 for outputs.",
              "type": "integer"
            }
          },
          "additionalProperties": false
        },
        "class_name": {
          "description": "CSS class name",
          "type": "string"
        },
        "style": {
          "description": "A 'style spec' object containing CSS strings to be applied to the SVG objects of the port.",
          "type": ["string", "object"]
        },
        "label": {
          "description": "Port name",
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "node_ui_def": {
      "description": "Node UI properties.",
      "type": "object",
      "properties": {
        "label": {
          "description": "User-defined label",
          "type": "string"
        },
        "description": {
          "description": "User-defined description",
          "type": "string"
        },
        "class_name": {
          "description": "CSS class name",
          "type": "string"
        },
        "style": {
          "description": "A 'style spec' object containing CSS strings to be applied to the SVG objects of the node.",
          "type": ["string", "object"]
        },
        "image": {
          "description": "URL to image source. Although a data URL can be used to embed an image inline, it is not recommended. The 'image' property can also be a JSX object that displays an image using an <svg> element however, JSX images must be set programmatically and cannot be stringified into JSON.",
          "type": ["string", "object"]
        },
        "x_pos": {
          "description": "x-position",
          "type": "number"
        },
        "y_pos": {
          "description": "y-position",
          "type": "number"
        },
        "is_expanded": {
          "description": "Indicates whether a supernode is shown in expanded state or as a regular node.",
          "type": "boolean"
        },
        "expanded_height": {
          "description": "Height of expanded supernode. If not provided an appropriate height is calculated.",
          "type": "number"
        },
        "expanded_width": {
          "description": "Width of expanded supernode. If not provided an appropriate width is calculated.",
          "type": "number"
        },
        "is_resized": {
          "description": "Indicates whether a node has been resized or not. If true, resize_width and resize_height are used for node display. If false, the default width and height are used.",
          "type": "boolean"
        },
        "resize_height": {
          "description": "Height of resized node. The node will be displayed with this height, when is_resized is true, in preference to its default height.",
          "type": "number"
        },
        "resize_width": {
          "description": "Width of resized node. The node will be displayed with this width, when is_resized is true, in preference to its default width.",
          "type": "number"
        },
        "sub_pipelines": {
          "description": "An array of pipelines referenced when this node is a supernode. This field is only used when the supernode is in a palette or on the clipboard. It will be an empty array when the supernode references an external pipeline.",
          "type": "array",
          "minItems": 0,
          "uniqueItems": true
        },
        "attributes": {
          "description": "additional attributes",
          "type": "string"
        },
        "associations": {
          "description": "Array of non-data node linkage",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/association_link_def"
          }
        },
        "messages": {
          "description": "An array of messages for the node",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/message_def"
          },
          "uniqueItems": true
        },
        "ui_parameters": {
          "description": "UI only parameter values for the node",
          "type": "object",
          "properties": {},
          "additionalProperties": true
        },
        "palette_image": {
          "description": "Image name for the node displayed in palette. If omitted the image from 'image' field will be used.",
          "type": "string"
        },
        "palette_class_name": {
          "description": "CSS class name applied to the <div> shown in palette for the node",
          "type": "string"
        },
        "palette_disabled": {
          "description": "Indicates whether the node in the palette is disabled. If true, prevents the node being dragged or double-clicked from palette.",
          "type": "boolean"
        },
        "decorations": {
          "description": "Array of decorations used to decorate nodes",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/node_decoration_def"
          },
          "uniqueItems": true
        }
      },
      "additionalProperties": true
    },
    "node_link_ui_def": {
      "description": "Node link UI properties.",
      "type": "object",
      "properties": {
        "description": {
          "description": "User-defined description",
          "type": "string"
        },
        "class_name": {
          "description": "CSS class name",
          "type": "string"
        },
        "style": {
          "description": "A 'style spec' object containing CSS strings to be applied to the SVG objects of the node to node link.",
          "type": ["string", "object"]
        },
        "decorations": {
          "description": "Array of decorations used to decorate node links",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/link_decoration_def"
          },
          "uniqueItems": true
        }
      },
      "additionalProperties": true
    },
    "runtime_ui_def": {
      "description": "Runtime UI properties.",
      "type": "object",
      "properties": {},
      "additionalProperties": true
    },
    "association_link_def": {
      "description": "Association link properties",
      "type": "object",
      "properties": {
        "id": {
          "description": "Association identifier",
          "type": "string"
        },
        "node_ref": {
          "description": "Target node id",
          "type": "string"
        },
        "class_name": {
          "description": "CSS class name for link styling",
          "type": "string"
        },
        "style": {
          "description": "A 'style spec' object containing CSS strings to be applied to the SVG objects of the association link.",
          "type": ["string", "object"]
        },
        "decorations": {
          "description": "Array of decorations used to decorate association links",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/link_decoration_def"
          },
          "uniqueItems": true
        }
      },
      "required": [
        "id",
        "node_ref"
      ],
      "additionalProperties": false
    },
    "node_decoration_def": {
      "description": "Decoration used to decorate a node",
      "properties": {
        "position": {
          "description": "Indicates an anchor point on the node at which the decoration will be displayed.",
          "enum": [
            "topLeft",
            "topCenter",
            "topRight",
            "middleLeft",
            "middleCenter",
            "middleRight",
            "bottomLeft",
            "bottomCenter",
            "bottomRight"
          ]
        }
      },
      "anyOf": [
        {
          "$ref": "#/definitions/image_decoration_def"
        },
        {
          "$ref": "#/definitions/label_decoration_def"
        },
        {
          "$ref": "#/definitions/shape_decoration_def"
        },
        {
          "$ref": "#/definitions/jsx_decoration_def"
        }
      ]
    },
    "link_decoration_def": {
      "description": "Decoration used to decorate a link",
      "properties": {
        "position": {
          "description": "Indicates an anchor point on the link at which the decoration will be displayed.",
          "enum": [
            "source",
            "middle",
            "target"
          ]
        },
        "distance": {
          "description": "Only applicable to straight link lines. Will move the decoration the specified number of pixels from its 'position'.",
          "type": "integer"
        }
      },
      "anyOf": [
        {
          "$ref": "#/definitions/image_decoration_def"
        },
        {
          "$ref": "#/definitions/label_decoration_def"
        },
        {
          "$ref": "#/definitions/shape_decoration_def"
        },
        {
          "$ref": "#/definitions/jsx_decoration_def"
        }
      ]
    },
    "image_decoration_def": {
      "description": "Image decoration properties including shared properties.",
      "type": "object",
      "allOf": [
        {
          "properties": {
            "image": {
              "description": "Image displayed at the decoration position. Provide either this or a label.",
              "type": "string"
            },
            "outline": {
              "description": "If true and outline is drawn around the image.",
              "type": "boolean"
            }
          }
        },
        { "$ref": "#/definitions/decoration_shared_properties" }
      ]
    },
    "label_decoration_def": {
      "description": "Label decoration properties including shared properties.",
      "type": "object",
      "allOf": [
        {
          "properties": {
            "label": {
              "description": "Label displayed at the decoration position. Provide either this or an image.",
              "type": "string"
            },
            "label_editable": {
              "description": "If true, the label decoration can be edited. It displays an edit icon which can be clicked to enter edit mode.",
              "type": "boolean"
            },
            "label_align": {
              "description": "The alignment of the label.",
              "enum": [
                "left",
                "center"
              ]
            },
            "label_single_line": {
              "description": "If true, the label is displayed as a single line and is truncated at the width.",
              "type": "boolean"
            },
            "label_max_characters": {
              "description": "The maximum number of characters that can be entered in the label decoration when it is editable.",
              "type": "integer"
            },
            "label_allow_return_key": {
              "description": "If false, pressing the return key in edit mode will not do anything: label will wrap at width. If true, return will enter a newline character. ",
              "type": "boolean"
            }
          }
        },
        { "$ref": "#/definitions/decoration_shared_properties" }
      ]
    },
    "shape_decoration_def": {
      "description": "Shape decoration properties including shared properties.",
      "type": "object",
      "allOf": [
        {
          "properties": {
            "path": {
              "description": "An SVG path that describes a shape to be drawn at the decoration position.",
              "type": "string"
            }
          }
        },
        { "$ref": "#/definitions/decoration_shared_properties" }
      ]
    },
    "jsx_decoration_def": {
      "description": "JSX decoration properties including shared properties These are never serialized in the pipeline flow.",
      "type": "object",
      "allOf": [
        {
          "properties": {
            "jsx": {
              "description": "A JSX expression that will be used to display the content of the decoration.",
              "type": "object"
            }
          }
        },
        { "$ref": "#/definitions/decoration_shared_properties" }
      ]
    },
    "decoration_shared_properties": {
      "description": "Shared properties across all types of decoration.",
      "type": "object",
      "properties": {
        "id": {
          "description": "A unique identifier used to identify the decoration",
          "type": "string"
        },
        "x_pos": {
          "description": "X position of the decorator relative to the decorations's position field.",
          "type": "integer"
        },
        "y_pos": {
          "description": "Y position of the decorator relative to the decorations's position field.",
          "type": "integer"
        },
        "width": {
          "description": "Display width of decoration.",
          "type": "integer"
        },
        "height": {
          "description": "Display height of decoration.",
          "type": "integer"
        },
        "hotspot": {
          "description": "Indicates whether the decorator is a hotspot or not. If true, it calls sends an event to the host app. when clicked",
          "type": "boolean"
        },
        "class_name": {
          "description": "CSS class name for decoration styling. It can be a space-separated list of classes.",
          "type": "string"
        },
        "tooltip": {
          "description": "Tooltip text for the decoration.",
          "type": "string"
        },
        "temporary": {
          "description": "If set to true, the decoration will not be serialized in the pipeline flow.",
          "type": "boolean"
        },
        "focusable": {
          "description": "Indicates whether the decoration can receive keyboard focus or not.",
          "type": "boolean"
        }
      },
      "required": [
        "id"
      ]

    },
    "message_def": {
      "description": "Node message definition",
      "type": "object",
      "properties": {
        "id_ref": {
          "description": "Name of the parameter that has the message",
          "type": "string"
        },
        "validation_id": {
          "description": "Validation identifier from the fail_message validation section.",
          "type": "string"
        },
        "type": {
          "description": "Type of message",
          "enum": [
            "info",
            "error",
            "warning"
          ]
        },
        "text": {
          "description": "Message string",
          "type": "string"
        }
      },
      "required": [
        "id_ref",
        "type",
        "text"
      ]
    },
    "comment_def": {
      "description": "Comment definition",
      "type": "object",
      "properties": {
        "id": {
          "description": "Comment identifier. Must be unique.",
          "type": "string"
        },
        "x_pos": {
          "description": "Horizontal comment position",
          "type": "number"
        },
        "y_pos": {
          "description": "Vertical comment position",
          "type": "number"
        },
        "width": {
          "description": "Comment width",
          "type": "number",
          "minimum": 10
        },
        "height": {
          "description": "Comment height",
          "type": "number",
          "minimum": 10
        },
        "class_name": {
          "description": "CSS class(es) to apply to the comment",
          "type": "string"
        },
        "style": {
          "description": "A 'style spec' object containing CSS strings to be applied to the SVG objects of the comment.",
          "type": ["string", "object"]
        },
        "attributes": {
          "description": "Optional attributes to be added to this element. For example: \"attributes\": \"attr1='value1'; attr2='value2'\"",
          "type": "string"
        },
        "content": {
          "description": "Comment content",
          "type": "string"
        },
        "content_type": {
          "description": "The type of content either regular or markdown or WYSIWYG",
          "type": "string"
        },
        "associated_id_refs": {
          "description": "Optional array of associated node id references",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/definitions/comment_link_def"
          },
          "uniqueItems": true
        }
      },
      "required": [
        "id",
        "x_pos",
        "y_pos",
        "width",
        "height"
      ],
      "additionalProperties": true
    },
    "comment_link_def": {
      "description": "Comment link definition",
      "type": "object",
      "properties": {
        "node_ref": {
          "description": "Node reference",
          "type": "string"
        },
        "class_name": {
          "description": "CSS class name for link styling",
          "type": "string"
        },
        "style": {
          "description": "A 'style spec' object containing CSS strings to be applied to the SVG objects of the comment link.",
          "type": ["string", "object"]
        }
      },
      "required": [
        "node_ref"
      ],
      "additionalProperties": true
    }
  }
}
