{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.internal/paddock/concept-library.schema.json",
  "title": "ConceptLibrary",
  "type": "object",
  "required": [
    "version",
    "concepts"
  ],
  "properties": {
    "version": {
      "type": "string",
      "const": "2.0"
    },
    "concepts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/concept"
      }
    }
  },
  "$defs": {
    "alias": {
      "type": "object",
      "required": [
        "text"
      ],
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1
        },
        "weight": {
          "type": "number",
          "minimum": 0,
          "maximum": 2,
          "default": 1
        },
        "strength": {
          "type": "string",
          "enum": [
            "strong",
            "medium",
            "weak"
          ]
        },
        "allowFuzzy": {
          "type": "boolean",
          "default": false
        },
        "allowLemma": {
          "type": "boolean",
          "default": true
        },
        "clientSafe": {
          "type": "boolean",
          "default": false
        }
      },
      "additionalProperties": false
    },
    "concept": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "canonical",
        "aliases"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9._-]+$"
        },
        "kind": {
          "type": "string",
          "enum": [
            "entity",
            "role",
            "proceeding",
            "forum",
            "legal_claim",
            "action",
            "state",
            "outcome",
            "amount",
            "date",
            "relation",
            "polarity"
          ]
        },
        "canonical": {
          "type": "string",
          "minLength": 1
        },
        "aliases": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/alias"
          }
        },
        "negatives": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/alias"
          }
        },
        "incompatibleConceptIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "notes": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
