{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://law.arxo.io/schema/import-coverage.schema.json",
  "type": "object",
  "properties": {
    "format": {
      "const": "arxo.import.coverage/0.1"
    },
    "selection": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "scope": {
      "type": "string"
    },
    "compiler_check": {
      "const": "not_run"
    },
    "input_hash": {
      "type": "string"
    },
    "mapping_hash": {
      "type": "string"
    },
    "total": {
      "type": "integer",
      "minimum": 0
    },
    "totals": {
      "type": "object",
      "additionalProperties": {
        "type": "integer",
        "minimum": 0
      }
    },
    "modules": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "reasons": {
      "type": "object",
      "additionalProperties": {
        "type": "integer",
        "minimum": 0
      }
    },
    "entries": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "inventory": {
            "type": "object",
            "properties": {
              "module": {
                "type": "string"
              },
              "kind": {
                "enum": [
                  "theorem",
                  "definition",
                  "axiom",
                  "instance"
                ]
              },
              "role": {
                "enum": [
                  "selected",
                  "dependency"
                ]
              },
              "diagnostic": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "module",
              "kind",
              "role",
              "diagnostic"
            ],
            "additionalProperties": false
          },
          "outcome": {
            "type": "object",
            "properties": {
              "status": {
                "enum": [
                  "rule",
                  "fact",
                  "catalogue",
                  "blocked"
                ]
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "target": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "anchor": {
                "type": "string"
              },
              "journal": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "expression": {
                      "type": "string"
                    },
                    "action": {
                      "type": "string"
                    },
                    "target": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "expression",
                    "action",
                    "target"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "status",
              "code",
              "message",
              "target",
              "anchor",
              "journal"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "inventory",
          "outcome"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "format",
    "selection",
    "scope",
    "compiler_check",
    "input_hash",
    "mapping_hash",
    "total",
    "totals",
    "modules",
    "reasons",
    "entries"
  ],
  "additionalProperties": false
}
