{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.internal/paddock/compiled-drill.schema.json",
  "title": "CompiledDrillV2",
  "type": "object",
  "required": [
    "version",
    "drillId",
    "buildHash",
    "analysisPolicy",
    "entityRegistry",
    "compiledAliases",
    "propositions",
    "clientRuntime"
  ],
  "properties": {
    "version": {
      "type": "string",
      "const": "2.0-compiled"
    },
    "drillId": {
      "type": "string"
    },
    "buildHash": {
      "type": "string"
    },
    "analysisPolicy": {
      "type": "object",
      "required": [
        "liveDebounceMs",
        "idleLlmDebounceMs",
        "downgradeHoldMs",
        "lexicalCandidateMinDistinctSlots",
        "denseCandidateMinSimilarity",
        "llmMaxCallsPerSession"
      ],
      "properties": {
        "liveDebounceMs": {
          "type": "integer",
          "minimum": 0
        },
        "idleLlmDebounceMs": {
          "type": "integer",
          "minimum": 0
        },
        "downgradeHoldMs": {
          "type": "integer",
          "minimum": 0
        },
        "lexicalCandidateMinDistinctSlots": {
          "type": "integer",
          "minimum": 1
        },
        "denseCandidateMinSimilarity": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "llmMaxCallsPerSession": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "entityRegistry": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "compiledAliases": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "conceptId",
          "aliasText",
          "normalized",
          "tokenCount",
          "weight",
          "source",
          "clientSafe"
        ],
        "properties": {
          "conceptId": {
            "type": "string"
          },
          "aliasText": {
            "type": "string"
          },
          "normalized": {
            "type": "string"
          },
          "tokenCount": {
            "type": "integer"
          },
          "weight": {
            "type": "number"
          },
          "source": {
            "type": "string",
            "enum": [
              "alias",
              "negative"
            ]
          },
          "clientSafe": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    },
    "propositions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "elementId",
          "circleLabel",
          "canonical",
          "kind",
          "requiredSlots",
          "optionalSlots",
          "discriminatorAliasTexts",
          "densePrototypeTexts",
          "negativePrototypeTexts",
          "llmEnabled"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "elementId": {
            "type": "string"
          },
          "circleLabel": {
            "type": "string"
          },
          "canonical": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "fact",
              "inference",
              "conclusion"
            ]
          },
          "requiredSlots": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "optionalSlots": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "discriminatorAliasTexts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "densePrototypeTexts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "negativePrototypeTexts": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "llmEnabled": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    },
    "clientRuntime": {
      "type": "object",
      "required": [
        "propositionHints"
      ],
      "properties": {
        "propositionHints": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "propositionId",
              "aliasTexts"
            ],
            "properties": {
              "propositionId": {
                "type": "string"
              },
              "aliasTexts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
