{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://offeringprotocol.org/schemas/filter-definition.schema.json",
  "title": "ODP Filter Definition",
  "type": "object",
  "required": [
    "id",
    "title",
    "description",
    "type",
    "operators"
  ],
  "properties": {
    "id": {
      "$ref": "capability-identifier.schema.json"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024
    },
    "type": {
      "$ref": "filter-type.schema.json"
    },
    "operators": {
      "type": "array",
      "minItems": 1,
      "maxItems": 7,
      "uniqueItems": true,
      "items": {
        "$ref": "filter-operator.schema.json"
      }
    },
    "unit": {
      "$ref": "filter-unit.schema.json"
    },
    "refinable": {
      "const": true
    }
  },
  "if": {
    "required": [
      "refinable"
    ]
  },
  "then": {
    "properties": {
      "operators": {
        "contains": {
          "enum": [
            "eq",
            "in"
          ]
        }
      }
    }
  }
}
