{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "anyOf": [
    {
      "type": "string",
      "const": "*"
    },
    {
      "type": "object",
      "properties": {
        "version": {
          "type": "number",
          "const": 1
        },
        "definitions": {
          "maxItems": 128,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "contract": {
                "type": "string",
                "const": "MenuDefinition"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "applicationId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "surface": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "menuId": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256
              },
              "nodes": {
                "maxItems": 1024,
                "type": "array",
                "items": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "nodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "parentNodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "order": {
                          "type": "integer",
                          "minimum": -1000000,
                          "maximum": 1000000
                        },
                        "kind": {
                          "type": "string",
                          "const": "group"
                        },
                        "label": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2}|-\\d{3})?$"
                              },
                              "additionalProperties": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          ]
                        },
                        "iconRef": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "disabled": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "nodeId",
                        "order",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "nodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "parentNodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "order": {
                          "type": "integer",
                          "minimum": -1000000,
                          "maximum": 1000000
                        },
                        "kind": {
                          "type": "string",
                          "const": "divider"
                        }
                      },
                      "required": [
                        "nodeId",
                        "order",
                        "kind"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "nodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "parentNodeId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "order": {
                          "type": "integer",
                          "minimum": -1000000,
                          "maximum": 1000000
                        },
                        "kind": {
                          "type": "string",
                          "const": "item"
                        },
                        "label": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1
                            },
                            {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2}|-\\d{3})?$"
                              },
                              "additionalProperties": {
                                "type": "string",
                                "minLength": 1
                              }
                            }
                          ]
                        },
                        "iconRef": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "tone": {
                          "type": "string",
                          "enum": [
                            "default",
                            "danger"
                          ]
                        },
                        "disabled": {
                          "type": "boolean"
                        },
                        "requiredPermission": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256
                        },
                        "behavior": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "navigate"
                                },
                                "page": {
                                  "type": "object",
                                  "properties": {
                                    "applicationId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 256
                                    },
                                    "pageId": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 256
                                    }
                                  },
                                  "required": [
                                    "applicationId",
                                    "pageId"
                                  ],
                                  "additionalProperties": false
                                },
                                "activationId": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 256
                                },
                                "input": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "exposure": {
                                          "type": "string",
                                          "const": "client"
                                        },
                                        "value": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string"
                                          },
                                          "additionalProperties": {
                                            "$ref": "#/$defs/__schema0"
                                          }
                                        }
                                      },
                                      "required": [
                                        "exposure",
                                        "value"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "exposure": {
                                          "type": "string",
                                          "const": "server"
                                        },
                                        "value": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string"
                                          },
                                          "additionalProperties": {
                                            "$ref": "#/$defs/__schema0"
                                          }
                                        }
                                      },
                                      "required": [
                                        "exposure",
                                        "value"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "page"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "action"
                                },
                                "actionRef": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 256
                                },
                                "input": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "$ref": "#/$defs/__schema0"
                                  }
                                }
                              },
                              "required": [
                                "kind",
                                "actionRef"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "required": [
                        "nodeId",
                        "order",
                        "kind",
                        "label",
                        "behavior"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              },
              "contributions": {
                "default": [],
                "maxItems": 1024,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "providerId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    },
                    "parentNodeId": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 256
                    },
                    "order": {
                      "type": "integer",
                      "minimum": -1000000,
                      "maximum": 1000000
                    }
                  },
                  "required": [
                    "providerId",
                    "order"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "contract",
              "version",
              "applicationId",
              "surface",
              "menuId",
              "nodes",
              "contributions"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "version",
        "definitions"
      ],
      "additionalProperties": false
    }
  ],
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema0"
          }
        }
      ]
    }
  },
  "$id": "https://schemas.infmonkeys.com/contracts/menu-definition-set.schema.json",
  "title": "menu-definition-set"
}
