{
  "definitions": {
    "condition": {
      "type": "object",
      "required": [
        "property"
      ],
      "properties": {
        "type": {
          "$id": "#/condition/type",
          "const": "simple",
          "description": "The type of the condition.",
          "default": "simple"
        },
        "property": {
          "$id": "#/condition/property",
          "type": "string",
          "description": "The id of the property to check."
        }
      },
      "oneOf": [
        {
          "properties": {
            "equals": {
              "type": [
                "string",
                "number",
                "boolean"
              ]
            }
          },
          "required": [
            "equals"
          ]
        },
        {
          "properties": {
            "oneOf": {
              "type": "array",
              "items": {
                "type": [
                  "string",
                  "number"
                ]
              }
            }
          },
          "required": [
            "oneOf"
          ]
        },
        {
          "properties": {
            "isActive": {
              "type": "boolean",
              "description": "For `true`, activates the property when given property is active"
            }
          },
          "required": [
            "isActive"
          ]
        }
      ]
    },
    "conditionDependingOnId": {
      "required": [
        "property"
      ],
      "properties": {
        "property": {
          "const": {
            "$data": "2/id"
          }
        }
      }
    }
  },
  "allOf": [
    {
      "$comment": "property#condition should not depend on property#id",
      "if": {
        "required": [
          "id",
          "condition"
        ],
        "properties": {
          "condition": {
            "$ref": "#/definitions/conditionDependingOnId"
          }
        }
      },
      "then": {
        "not": {
          "required": [ "condition" ]
        }
      }
    }
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier of the property."
    },
    "condition": {
      "type": "object",
      "description": "Condition(s) to activate the binding.",
      "allOf": [
        {
          "$ref": "examples.json#/condition"
        }
      ],
      "oneOf": [
        {
          "$ref": "#/definitions/condition"
        },
        {
          "properties": {
            "allMatch": {
              "$id": "#/allMatch",
              "type": "array",
              "items": {
                "$ref": "#/definitions/condition"
              },
              "minItems": 1
            }
          },
          "required": [
            "allMatch"
          ]
        }
      ]
    }
  }
}
