{
  "$schema": "https://json-schema.org/draft-04/schema#",
  "id": "https://api.dataplatform.ibm.com/schemas/common-pipeline/operators/uihints-v2-schema.json",
  "description": "WDP UI Hints schema",
  "title": "WDP UI Hints schema",
  "type": "object",
  "properties": {
    "id": {
      "description": "Operator identifier",
      "type": "string"
    },
    "json_schema": {
      "description": "Refers to the JSON schema used to validate documents of this type",
      "enum": [
        "https://api.dataplatform.ibm.com/schemas/common-pipeline/operators/uihints-v2-schema.json"
      ]
    },
    "label": {
      "description": "External name of operator",
      "type": "object",
      "$ref": "#/definitions/resource_definition"
    },
    "description": {
      "description": "Description of operator",
      "type": "object",
      "$ref": "#/definitions/resource_definition"
    },
    "icon": {
      "description": "URL to operation icon",
      "type": "string"
    },
    "group_info": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/group_definition"
      }
    },
    "editor_size": {
      "description": "Editor size for node edits",
      "enum": [
        "small",
        "medium",
        "large"
      ]
    },
    "pixel_width": {
      "description": "Gives more control of editor panel width. The panel is shown at min size if editor_size is small and max size if editor_size is medium. If min and max are the same no sizing button is displayed.",
      "type": "object",
      "properties": {
        "min": {
          "description": "Minimum size in pixels for the right side editor flyout",
          "type": "number"
        },
        "max": {
          "description": "Maximum size in pixels for the right side editor flyout",
          "type": "number"
        }
      }
    },
    "parameter_info": {
      "items": {
        "$ref": "#/definitions/parameter_definition"
      },
      "type": "array"
    },
    "complex_type_info": {
      "items": {
        "$ref": "#/definitions/complex_type_definition"
      },
      "type": "array"
    },
    "ui_parameters": {
      "description": "List of UI only parameters",
      "type": "array",
      "items": {
        "$ref": "https://api.dataplatform.ibm.com/schemas/common-pipeline/operator/operator-v2-schema.json#/definitions/parameter_definition"
      }
    },
    "action_info": {
      "items": {
        "$ref": "#/definitions/action_definition"
      },
      "type": "array"
    },
    "help": {
      "description": "Help information",
      "type": "object",
      "properties": {
        "data": {
          "description": "Data passed in the helpClickHandler.",
          "type": "object",
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    }
  },
  "required": [
    "id"
  ],
  "definitions": {
    "group_definition": {
      "description": "Grouping for parameters and groups",
      "type": "object",
      "properties": {
        "id": {
          "description": "Identifier for this group",
          "type": "string"
        },
        "type": {
          "description": "The group type to be displayed",
          "type": "string",
          "enum": [
            "controls",
            "tabs",
            "subTabs",
            "panels",
            "columnSelection",
            "columnSelectionRecursive",
            "panelSelector",
            "customPanel",
            "summaryPanel",
            "actionPanel",
            "textPanel",
            "twistyPanel"
          ]
        },
        "depends_on_ref": {
          "description": "Parameter name this group depends upon. Valid for panelSelector groups only.",
          "type": "string"
        },
        "insert_panels": {
          "description": "Indicates whether panels, contained with a panelSelector, should be inserted between the radio buttons of a radio button set indicated by the depends_on_ref parameter.",
          "type": "boolean"
        },
        "label": {
          "description": "Group label",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "description": {
          "description": "Group description. Used in a textPanel",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "parameter_refs": {
          "description": "List of parameters to be displayed",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "action_refs": {
          "description": "List of actions to be displayed.  Used with an actionPanel",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "data": {
          "description": "Data passed to custom panel when group type is 'customPanel'",
          "type": "object",
          "additionalProperties": true
        },
        "group_info": {
          "items": {
            "$ref": "#/definitions/group_definition"
          },
          "type": "array"
        }
      },
      "required": [
        "id"
      ]
    },
    "parameter_definition": {
      "description": "Operator parameters hints",
      "type": "object",
      "properties": {
        "parameter_ref": {
          "description": "Parameter reference to base operator parameter definition",
          "type": "string"
        },
        "label": {
          "description": "External name for parameter",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "label_visible": {
          "description": "Whether to display the label or not. If not displayed, the label can still be used by screen readers",
          "type": "boolean",
          "default": true
        },
        "description": {
          "description": "Description of parameter with optional placement context",
          "type": "object",
          "allOf": [
            {
              "$ref": "#/definitions/resource_definition"
            },
            {
              "properties": {
                "placement": {
                  "description": "Optional placement context for the text",
                  "enum": [
                    "as_tooltip",
                    "on_panel"
                  ],
                  "default": "as_tooltip"
                }
              }
            }
          ]
        },
        "control": {
          "description": "Which control to use.  In most cases the control gets to be determined and should not be set",
          "type": "string",
          "enum": [
            "readonly",
            "textfield",
            "passwordfield",
            "textarea",
            "expression",
            "numberfield",
            "spinner",
            "checkbox",
            "radioset",
            "checkboxset",
            "toggletext",
            "oneofselect",
            "someofselect",
            "selectcolumn",
            "selectcolumns",
            "structuretable",
            "structurelisteditor",
            "structureeditor",
            "custom",
            "datefield",
            "timefield",
            "timestampfield"
          ]
        },
        "increment": {
          "description": "Determines the increment/decrement value for the spinner control only",
          "type": "number",
          "default": 1
        },
        "orientation": {
          "description": "Determines how the control is displayed",
          "type": "string",
          "enum": [
            "vertical",
            "horizontal"
          ]
        },
        "width": {
          "description": "Percentage of group width the control should use",
          "type": "number"
        },
        "char_limit": {
          "description": "Limits the number of characters a user can enter into the control for string parameters only",
          "type": "number"
        },
        "display_chars": {
          "description": "Limits the number of characters displayed for a text field in a column in a table.  The text will have an ellipsis appended at this limit.",
          "type": "number",
          "default": 64
        },
        "separator": {
          "description": "Determines where to put a separator relative to the current control",
          "type": "string",
          "enum": [
            "before",
            "after"
          ]
        },
        "visible": {
          "description": "Determines whether to display parameter in control. Used in complex structures",
          "type": "boolean"
        },
        "place_holder_text": {
          "description": "Text hint for the user displayed input controls",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "text_before": {
          "description": "Static text to be displayed before the control",
          "type": "object",
          "$ref": "#/definitions/text_definition"
        },
        "text_after": {
          "description": "Static text to be displayed after the control",
          "type": "object",
          "$ref": "#/definitions/text_definition"
        },
        "resource_key": {
          "description": "Used as a key for enum value labels",
          "type": "string"
        },
        "edit_style": {
          "description": "Editing style of elements in a table",
          "type": "string",
          "enum": [
            "subpanel",
            "inline",
            "on_panel"
          ]
        },
        "value_icons": {
          "description": "For enumerated types, this defines the set of icons for the valid values. The ordering must be consistent with the order in the parameter enum attribute.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "sortable": {
          "description": "Determines if this column values can be sorted into ascending/descending order in a table. Applies to structure parameters only.",
          "type": "boolean"
        },
        "filterable": {
          "description": "Determines if this column values can be filtered so that only rows that match the filter in column values are shown in the table. Applies to structure parameters only.",
          "type": "boolean"
        },
        "language": {
          "description": "The language for the expression editor syntax highlight and autocomplete workds. Applies to expression control type.",
          "type": "string",
          "enum": [
            "CLEM",
            "text/x-hive",
            "text/x-rsrc",
            "text/x-python"
          ]
        },
        "summary": {
          "description": "Determines if this column values will be shown in the summaryPanel",
          "type": "boolean"
        },
        "generated_values": {
          "description": "Generates values for a column in a 'readonly' parameter.",
          "type": "object",
          "properties": {
            "operation": {
              "description": "Currently only 'index' is supported which will auto-increment the integer column value starting at 1. The start value can be configured by setting a start_value.",
              "type": "string",
              "enum": [
                "index"
              ]
            },
            "start_value": {
              "description": "Optional start value to increment from when the 'type' is 'index'. If the start_value is not set, it will default to 1.",
              "type": "integer"
            }
          },
          "required": [
            "operation"
          ]
        },
        "number_generator": {
          "description": "Adds a number generation link beside the label of this control",
          "type": "object",
          "properties": {
            "label": {
              "description": "Link text",
              "type": "object",
              "$ref": "#/definitions/resource_definition"
            },
            "range": {
              "description": "Number generator range",
              "type": "object",
              "properties": {
                "min": {
                  "description": "Maximum value for generated numbers",
                  "type": "number"
                }
              },
              "required": [
                "min",
                "max"
              ]
            }
          },
          "required": [
            "label"
          ]
        },
        "dm_default": {
          "description": "Used within complex structures containing 'column' key_definition fields. This associates the subControl parameter with a field attribute in the current record schema.",
          "type": "string",
          "enum": [
            "type",
            "description",
            "measure",
            "modeling_role"
          ]
        },
        "dm_icon": {
          "description": "This can be set to display an icon of the corresponding dm type in the `role`:`column' field of a table.",
          "type": "string",
          "enum": [
            "measure",
            "none"
          ]
        },
        "custom_control_id": {
          "description": "Used to determine which custom control to use when control=custom.",
          "type": "string"
        },
        "data": {
          "description": "Data passed to custom control when control=custom",
          "type": "object",
          "additionalProperties": true
        },
        "date_format": {
          "description": "A format string such as YYYY-MM-DD which describes the display and entry format for a date field.",
          "type": "string"
        },
        "time_format": {
          "description": "A format string such as HH:mm:ss which describes the display and entry format for a time field.",
          "type": "string"
        },
        "moveable_rows": {
          "description": "Determines if rows can be moved up or down in a table or array of strings",
          "type": "boolean"
        },
        "rows": {
          "description": "Number of rows to display in tables",
          "type": "integer",
          "default": 4
        },
        "action_ref": {
          "description": "Determines an action should be added to the control",
          "type": "string"
        }
      },
      "required": [
        "parameter_ref"
      ]
    },
    "complex_type_definition": {
      "type": "object",
      "description": "Complex parameters",
      "properties": {
        "complex_type_ref": {
          "type": "string",
          "description": "Name of complex type, can be referenced in other places."
        },
        "label": {
          "description": "External name used in subpanels",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "key_definition": {
          "$ref": "#/definitions/parameter_definition"
        },
        "layout": {
          "description": "Array of rows containing structure element names",
          "type": "array",
          "items": {
            "description": "A single row of structure parameter names for laying out horizontally",
            "type": "array",
            "items": {
              "description": "A parameter name within the current structure",
              "type": "string"
            }
          }
        },
        "parameters": {
          "type": "array",
          "description": "List of parameters",
          "items": {
            "anyOf": [
              {
                "$ref": "#/definitions/parameter_definition"
              },
              {
                "$ref": "#/definitions/complex_type_definition"
              }
            ]
          }
        },
        "add_remove_rows": {
          "description": "Determines if the table can have rows added and removed",
          "type": "boolean",
          "default": true
        },
        "row_selection": {
          "description": "Determines how many rows can be selected at a time.  'multiple-edit': select multiple rows and allow the editing of column values for all selected rows.",
          "type": "string",
          "enum": [
            "single",
            "multiple",
            "multiple-edit"
          ]
        },
        "header": {
          "description": "Determines if the table header should be displayed",
          "type": "boolean",
          "default": true
        },
        "include_all_fields": {
          "description": "Use when `add_remove_rows` is false. Ensures the control contains a record for each field in the data model.",
          "type": "boolean",
          "default": true
        }
      },
      "required": [
        "complex_type_ref",
        "parameters"
      ]
    },
    "action_definition": {
      "description": "Actions that callback to application",
      "type": "object",
      "properties": {
        "id": {
          "description": "Identifier for this action",
          "type": "string"
        },
        "description": {
          "description": "Description of action.  Use for tooltip.",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "control": {
          "description": "The action type to be displayed",
          "type": "string",
          "enum": [
            "button",
            "image"
          ]
        },
        "label": {
          "description": "Action label",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "image": {
          "description": "Properties for how the image will look.  Use when control=image.",
          "type": "object",
          "properties": {
            "url": {
              "description": "image url to be used for action",
              "type": "string"
            },
            "placement": {
              "description": "placement of the action image",
              "enum": [
                "right",
                "left"
              ]
            },
            "size": {
              "description": "pixel size of the image.",
              "type": "object",
              "properties": {
                "height": {
                  "description": "image height in pixels",
                  "type": "number"
                },
                "width": {
                  "description": "image width in pixels",
                  "type": "number"
                }
              }
            }
          }
        },
        "data": {
          "description": "Data returned when action called",
          "type": "object",
          "additionalProperties": true
        }
      },
      "required": [
        "id"
      ]
    },
    "resource_definition": {
      "description": "Localizable string resource",
      "type": "object",
      "properties": {
        "default": {
          "type": "string"
        },
        "resource_key": {
          "type": "string"
        }
      },
      "oneOf": [
        {
          "required": [
            "default"
          ]
        },
        {
          "required": [
            "resource_key"
          ]
        }
      ]
    },
    "text_definition": {
      "description": "Static text to be displayed before or after the control",
      "type": "object",
      "allOf": [
        {
          "$ref": "#/definitions/resource_definition"
        },
        {
          "properties": {
            "type": {
              "description": "Type of text message to display",
              "enum": [
                "info"
              ]
            }
          }
        }
      ]
    }
  }
}
