{
  "$schema": "https://json-schema.org/draft-04/schema#",
  "id": "https://api.dataplatform.ibm.com/schemas/common-pipeline/operators/uihints-v3-schema.json#",
  "description": "UI Hints schema",
  "title": "UI Hints",
  "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-v3-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"
    },
    "title_info": {
      "type": "object",
      "properties": {
        "action_refs": {
          "description": "List of actions to be displayed in the title section",
          "type": "array",
          "items": {
            "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/operators/operator-v3-schema.json#/definitions/operator_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",
            "tearsheetPanel",
            "columnPanel"
          ]
        },
        "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"
        },
        "nested_panel": {
          "description": "Indicate whether panel should be nested. Nested panels are indented by 16px from the left and display left border. Default is false.",
          "type": "boolean"
        },
        "open": {
          "description": "Used to determine if a panel is open or closed when UI is displayed.  Currenty only supported with twistyPanel. Default is false.",
          "type": "boolean"
        },
        "label": {
          "description": "Group label",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "description": {
          "description": "Group description. Used in a textPanel and tearsheetPanel",
          "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'",
          "additionalProperties": true,
          "oneOf": [
            {
              "type": "object"
            },
            {
              "type": "array"
            }
          ]
        },
        "group_info": {
          "items": {
            "$ref": "#/definitions/group_definition"
          },
          "type": "array"
        },
        "class_name": {
          "description": "Optional class name to set for this group",
          "type": "string"
        }
      },
      "required": [
        "id"
      ]
    },
    "parameter_definition": {
      "description": "UI Hint Parameter Definition",
      "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 and optional link",
          "type": "object",
          "allOf": [
            {
              "$ref": "#/definitions/resource_definition"
            },
            {
              "properties": {
                "placement": {
                  "description": "Optional placement context for the text",
                  "enum": [
                    "as_tooltip",
                    "on_panel"
                  ],
                  "default": "as_tooltip"
                },
                "link": {
                  "description": "Optional link in the description. tooltipLinkHandler callback must be defined whenever link object is added in uiHints.",
                  "type": "object",
                  "properties": {
                    "id": {
                      "description": "link id",
                      "type": "string"
                    },
                    "data": {
                      "description": "Data passed to the tooltipLinkHandler callback",
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "id"
                  ]
                }
              }
            }
          ]
        },
        "control": {
          "description": "Which control to use.  In most cases the control gets to be determined and should not be set",
          "type": "string",
          "enum": [
            "readonly",
            "readonlyTable",
            "textfield",
            "passwordfield",
            "textarea",
            "expression",
            "numberfield",
            "spinner",
            "checkbox",
            "radioset",
            "checkboxset",
            "toggletext",
            "toggle",
            "oneofselect",
            "multiselect",
            "someofselect",
            "selectcolumn",
            "selectcolumns",
            "selectschema",
            "structuretable",
            "structurelisteditor",
            "structureeditor",
            "custom",
            "datefield",
            "datepicker",
            "datepickerRange",
            "timefield",
            "timestampfield",
            "slider",
            "code",
            "list",
            "hidden"
          ]
        },
        "increment": {
          "description": "Determines the step value to increment/decrement for spinner and slider controls",
          "type": "number",
          "default": 1
        },
        "min_value": {
          "description": "Determines the minimum value for the slider control only",
          "type": "number",
          "default": 1
        },
        "max_value": {
          "description": "Determines the max value for the slider control only",
          "type": "number",
          "default": 1
        },
        "orientation": {
          "description": "Determines how the control is displayed",
          "type": "string",
          "enum": [
            "vertical",
            "horizontal"
          ]
        },
        "width": {
          "description": "A number as percentage of group width the control should use, or a string specifying the number of pixels wide the column should be.",
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            }
          ]
        },
        "char_limit": {
          "description": "Limits the number of characters a user can enter into the control for string parameters only",
          "type": "number"
        },
        "display_chars": {
          "description": "This has been deprecated and is subject to removal. 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"
        },
        "helper_text": {
          "description": "Additional text to be displayed below the control",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "read_only": {
          "description": "Determines whether the control should be readonly or can be edited",
          "type": "boolean"
        },
        "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 and multiselect control only.",
          "type": "boolean"
        },
        "resizable": {
          "description": "Determines if this column can be resized in a table. When a column is resized, width of all the columns to the right of resized column is adjusted. Applies to structure parameters only.",
          "type": "boolean",
          "default": false
        },
        "language": {
          "description": "The language for the expression editor syntax highlight and autocomplete workds. Applies to expression control type.",
          "type": "string",
          "enum": [
            "CLEM",
            "javascript",
            "text/x-hive",
            "text/x-rsrc",
            "text/x-python",
            "text/x-sql"
          ]
        },
        "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 button beside the numeric control",
          "type": "object",
          "properties": {
            "label": {
              "description": "Number generator button label. It is visible on hover.",
              "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"
        },
        "custom_value_allowed": {
          "description": "Determines if a dropdown, outside of a table, can allow a custom value to be entered",
          "type": "boolean"
        },
        "should_filter_item": {
          "description": "Determines if a dropdown, outside of a table, can allow the dropdown items to be filtered by the custom value entered",
          "type": "boolean",
          "default": false
        },
        "class_name": {
          "description": "Optional class name to set for this control",
          "type": "string"
        },
        "enable_maximize": {
          "description": "Determines if maximize/minimze buttons are shown for code control",
          "type": "boolean"
        }
      },
      "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
        },
        "buttons": {
          "description": "Display custom buttons in place of any buttons from the table. Will override 'add_remove_rows' and readonlyTable edit buttons.",
          "type": "array",
          "items": {
            "$ref": "#/definitions/button_definition"
          }
        }
      },
      "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",
            "custom"
          ]
        },
        "class_name": {
          "description": "Optional class name to set for this action",
          "type": "string"
        },
        "label": {
          "description": "Action label",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "button": {
          "description": "Properties for button kind and size. Use when control=button.",
          "type": "object",
          "properties": {
            "kind": {
              "description": "button kind",
              "type": "string",
              "enum": [
                "primary",
                "secondary",
                "tertiary",
                "ghost",
                "danger",
                "danger--tertiary",
                "danger--ghost"
              ],
              "default": "tertiary"
            },
            "size": {
              "description": "button size",
              "enum": [
                "sm",
                "md",
                "lg",
                "xl"
              ],
              "default": "sm"
            }
          }
        },
        "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"
                }
              }
            },
            "tooltip_direction": {
              "description": "Action image tooltip direction.",
              "enum": [
                "right",
                "left",
                "top",
                "bottom"
              ],
              "default": "bottom"
            }
          }
        },
        "custom_action_id": {
          "description": "Used to determine which custom action to use when control=custom.",
          "type": "string"
        },
        "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"
        }
      },
      "anyOf": [
        {
          "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"
              ]
            }
          }
        }
      ]
    },
    "button_definition": {
      "description": "Button to be displayed after the table's search bar",
      "type": "object",
      "properties": {
        "id": {
          "description": "Button identifier used to idenify the button in the callback function",
          "type": "string"
        },
        "label": {
          "description": "Button label to display. If an icon is specified as well, the icon will be shown to the right of the label.",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "description": {
          "description": "Tooltip text to display when the button is hovered",
          "type": "object",
          "$ref": "#/definitions/resource_definition"
        },
        "icon": {
          "description": "URL to .svg image to display",
          "type": "string"
        },
        "carbon_icon": {
          "description": "Host provided name of Carbon icon to display. A callback function is required for the host application to return the jsx icon object imported from @carbon/icons-react library",
          "type": "string"
        },
        "enabled": {
          "description": "Button will be enabled if true, disabled if false",
          "type": "boolean",
          "default": false
        },
        "divider": {
          "description": "Display a divider before or after this button",
          "type": "string",
          "enum": [
            "before",
            "after"
          ],
          "default": "after"
        },
        "kind": {
          "description": "The 'kind' of button to use. This must align with the 'kind' from Carbon buttons",
          "type": "string",
          "enum": [
            "default",
            "primary",
            "danger",
            "secondary",
            "tertiary",
            "ghost"
          ],
          "default": "ghost"
        }
      },
      "anyOf": [
        {
          "required": [
            "id",
            "label"
          ]
        },
        {
          "required": [
            "id",
            "icon",
            "description"
          ]
        },
        {
          "required": [
            "id",
            "carbon_icon",
            "description"
          ]
        }
      ]
    }
  }
}
