{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "propositionId": {
      "type": "string"
    },
    "documentId": {
      "type": "string"
    },
    "owner": {
      "type": "string"
    },
    "ref": {
      "type": "string"
    },
    "anchor": {
      "type": "object",
      "properties": {
        "doc": {
          "$ref": "#/$defs/SelectorBundle"
        },
        "code": {
          "default": [],
          "type": "array",
          "items": {
            "$ref": "#/$defs/SelectorBundle"
          }
        }
      },
      "required": [
        "doc",
        "code"
      ],
      "additionalProperties": false
    },
    "enforcement": {
      "default": "enforced",
      "type": "string",
      "enum": [
        "suggested",
        "enforced",
        "retired"
      ]
    },
    "verified": {
      "default": false,
      "type": "boolean"
    },
    "verifiers": {
      "default": [],
      "type": "array",
      "items": {
        "$ref": "#/$defs/Verifier"
      }
    },
    "ttl": {
      "type": "string"
    },
    "attrs": {
      "default": {},
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "id",
    "propositionId",
    "documentId",
    "owner",
    "ref",
    "anchor",
    "enforcement",
    "verified",
    "verifiers",
    "attrs"
  ],
  "additionalProperties": false,
  "$defs": {
    "SelectorBundle": {
      "type": "object",
      "properties": {
        "file": {
          "type": "string"
        },
        "selectors": {
          "minItems": 1,
          "type": "array",
          "items": {
            "$ref": "#/$defs/Selector"
          }
        }
      },
      "required": [
        "file",
        "selectors"
      ],
      "additionalProperties": false
    },
    "Selector": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "text-quote"
            },
            "exact": {
              "type": "string"
            },
            "prefix": {
              "default": "",
              "type": "string"
            },
            "suffix": {
              "default": "",
              "type": "string"
            }
          },
          "required": [
            "kind",
            "exact",
            "prefix",
            "suffix"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "text-position"
            },
            "start": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "end": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "kind",
            "start",
            "end"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "ast-node"
            },
            "language": {
              "type": "string"
            },
            "nodeType": {
              "type": "string"
            },
            "structuralHash": {
              "type": "string"
            },
            "semanticHash": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "language",
            "nodeType",
            "structuralHash",
            "semanticHash"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "value"
            },
            "language": {
              "type": "string"
            },
            "nodeKind": {
              "type": "string"
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "language",
            "nodeKind",
            "value"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "coarse"
            },
            "pattern": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "pattern"
          ],
          "additionalProperties": false
        }
      ]
    },
    "Verifier": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "minLength": 1
        },
        "ref": {
          "type": "string"
        }
      },
      "required": [
        "kind",
        "ref"
      ],
      "additionalProperties": false
    }
  }
}
