{
  "$schema": "https://json-schema.org/draft-04/schema#",
  "id": "https://api.dataplatform.ibm.com/schemas/common-pipeline/operators/uihints-v1-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-v1-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"
      ]
    },
    "parameter_info": {
      "items": {
        "$ref": "#/definitions/parameter_definition"
      },
      "type": "array"
    },
    "complex_type_info": {
      "items": {
        "$ref": "#/definitions/complex_type_definition"
      },
      "type": "array"
    },
    "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",
            "panelSelector",
            "checkboxPanel",
            "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",
            "custom",
            "datefield",
            "timefield"
          ]
        },
        "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"
        },
        "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"
          ]
        },
        "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"
          ]
        },
        "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
        }
      },
      "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"
        },
        "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.",
          "type": "string",
          "enum": [
            "single",
            "multiple"
          ]
        },
        "header": {
          "description": "Determines if the table header should be displayed",
          "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"
        },
        "control": {
          "description": "The action type to be displayed",
          "type": "string",
          "enum": [
            "button"
          ]
        },
        "label": {
          "description": "Action label",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "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"
              ]
            }
          }
        }
      ]
    }
  }
}
